Submission #154182

#TimeUsernameProblemLanguageResultExecution timeMemory
154182BabinSinkoZamjena (COCI18_zamjena)C++14
Compilation error
0 ms0 KiB
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> #include <vector> #include <string> using namespace std; int n, sol; string s1[500003], s2[500003], ts; int main(){ cin >> n; for (int i= 0; i < n; i++){ cin >> s1[i]; } for (int i= 0; i < n; i++){ cin >> s2[i]; } for (int i= 0; i < n; i++){ if (s1[i][0] <= 57 and s2[i][0] <= 57){ if (s1[i] != s2[i]) sol = 1; } if (s1[i][0] <= 57 and s2[i][0] > 57){ ts = s2[i]; for (int j = 0; j < n; j++){ if (s1[j] == ts){ s1[j] = s1[i]; } if (s2[j] == ts){ s2[j] = s1[i]; } } } if (s1[i][0] > 57 and s2[i][0] <= 57){ ts = s1[i]; for (int j = 0; j < n; j++){ #include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cctype> #include <ctime> #include <vector> #include <string> using namespace std; int n, sol; string s1[500003], s2[500003], ts; int main(){ cin >> n; for (int i= 0; i < n; i++){ cin >> s1[i]; } for (int i= 0; i < n; i++){ cin >> s2[i]; } for (int k = 0; k < 10; k++){ for (int i= 0; i < n; i++){ if (s1[i][0] <= 57 and s2[i][0] <= 57){ if (s1[i] != s2[i]) sol = 1; } if (s1[i][0] <= 57 and s2[i][0] > 57){ ts = s2[i]; for (int j = 0; j < n; j++){ if (s1[j] == ts){ s1[j] = s1[i]; } if (s2[j] == ts){ s2[j] = s1[i]; } } } if (s1[i][0] > 57 and s2[i][0] <= 57){ ts = s1[i]; for (int j = 0; j < n; j++){ if (s1[j] == ts){ s1[j] = s2[i]; } if (s2[j] == ts){ s2[j] = s2[i]; } } } } } for (int i= 0; i < n; i++){ cout << s1[i][0] << " " << s2[i][0] << endl; if (s1[i] != s2[i] and s1[i][0] <= 57 and s2[i][0] <= 57){ sol = 1; } } if (sol == 1){ cout << "NE"; }else{ cout << "DA"; } return 0; }

Compilation message (stderr)

zamjena.cpp: In function 'int main()':
zamjena.cpp:56:11: error: a function-definition is not allowed here before '{' token
 int main(){
           ^
zamjena.cpp:106:1: error: expected '}' at end of input
 }
 ^
zamjena.cpp:53:5: warning: unused variable 'n' [-Wunused-variable]
 int n, sol;
     ^
zamjena.cpp:53:8: warning: unused variable 'sol' [-Wunused-variable]
 int n, sol;
        ^~~
zamjena.cpp:106:1: error: expected '}' at end of input
 }
 ^
zamjena.cpp:106:1: error: expected '}' at end of input
zamjena.cpp:106:1: error: expected '}' at end of input