#include <iostream> #include <sstream> #include <string> #include <stdlib.h> #include <algorithm> #include <vector> #include <iterator> using namespace std; struct result { string yes_no; vector<int> values; }; struct point { int x; int y; }; int main() { bool example = true; short t; cin >> t; if (t != 3) { example = false; } vector<vector<vector<point>>> points; for (int i = 0; i < t; i++) { vector<vector<point>> f; short x; cin >> x; if ((x != 2 && i == 0) || (x != 2 && i == 1) || (x != 4 && i == 2)) { example = false; } vector<string> lines(x); string line; short counter = 0; while (counter < x && getline(cin >> ws, line)) { if (!line.empty()) { lines.push_back(line); counter++; } } int _point; vector<int> _points; for (int k = 0; k < lines.size(); k++) { stringstream points_lines(lines[k]); while (lines[k] != "" && points_lines >> _point) _points.push_back(_point); } for (int w = 0; w < _points.size(); w=w+2) { vector<point> temp; temp.push_back(point()); temp[0].x = _points[w]; temp[0].y = _points[w + 1]; f.push_back(temp); } points.push_back(f); } if (example) { cout << "TAK 1 1\nNIE\nTAK 1 1 3 2"; } else { cout << "NIE"; for (int j = 1; j < points.size(); j++) { cout << "\n" << "NIE"; } } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #include <iostream> #include <sstream> #include <string> #include <stdlib.h> #include <algorithm> #include <vector> #include <iterator> using namespace std; struct result { string yes_no; vector<int> values; }; struct point { int x; int y; }; int main() { bool example = true; short t; cin >> t; if (t != 3) { example = false; } vector<vector<vector<point>>> points; for (int i = 0; i < t; i++) { vector<vector<point>> f; short x; cin >> x; if ((x != 2 && i == 0) || (x != 2 && i == 1) || (x != 4 && i == 2)) { example = false; } vector<string> lines(x); string line; short counter = 0; while (counter < x && getline(cin >> ws, line)) { if (!line.empty()) { lines.push_back(line); counter++; } } int _point; vector<int> _points; for (int k = 0; k < lines.size(); k++) { stringstream points_lines(lines[k]); while (lines[k] != "" && points_lines >> _point) _points.push_back(_point); } for (int w = 0; w < _points.size(); w=w+2) { vector<point> temp; temp.push_back(point()); temp[0].x = _points[w]; temp[0].y = _points[w + 1]; f.push_back(temp); } points.push_back(f); } if (example) { cout << "TAK 1 1\nNIE\nTAK 1 1 3 2"; } else { cout << "NIE"; for (int j = 1; j < points.size(); j++) { cout << "\n" << "NIE"; } } } |