Adding some more judges, here and there.
[and.git] / NEERC / database / database_gk_ok_cpp_map_pair.cpp
blob241f8d95dcd213fb3a8ee1db4bc6de630278f992
1 #include <iostream>
2 #include <fstream>
3 #include <string>
4 #include <vector>
5 #include <map>
7 using namespace std;
9 int main() {
10 ifstream in; in.open("database.in");
11 ofstream out; out.open("database.out");
13 int n;
14 int m;
15 in >> n >> m;
16 in.ignore();
18 cout << n << endl;
19 vector<vector<string>*> values;
20 for (int i = 0; i < n; i++) {
21 char buffer[100];
22 vector<string>* row = new vector<string>();
24 for (int j = 0; j < m - 1; j++) {
25 in.getline(buffer, sizeof(buffer) / sizeof(char), ',');
26 row->push_back(buffer);
29 in.getline(buffer, sizeof(buffer) / sizeof(char), '\n');
30 row->push_back(buffer);
32 values.push_back(row);
35 for (int c1 = 0; c1 < m; c1++) {
36 cout << c1;
37 for (int c2 = c1 + 1; c2 < m; c2++) {
38 map<pair<string, string>, int> map;
39 for (int r1 = 0; r1 < n; r1++) {
40 string s1 = values[r1]->at(c1);
41 string s2 = values[r1]->at(c2);
42 pair<string, string> s(s1, s2);
43 if (map.find(s) != map.end()) {
44 int r2 = map.find(s)->second;
46 out << "NO" << endl;
47 out << (r2 + 1) << " " << (r1 + 1) << endl;
48 out << (c1 + 1) << " " << (c2 + 1) << endl;
49 return 0;
51 map[s] = r1;
57 out << "YES" << endl;
59 in.close();
60 out.close();
62 return 0;