#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define sz(x) (int)x.size()
#define ff first
#define ss second
const ll N = 3005;
const ll M = 1e9 + 7;
int T, n, a[N][N];
map <string, int> m;
map <int,bool> vis;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin >> n;
int cnt = 0;
for(int i = 1; i <= n; i++){
string s;
cin >> s;
if(m[s] == 0){
cnt++;
m[s] = cnt;
}
else {
string l1;
cin >> l1;
while(1){
cin >> l1;
if(l1 == ";") break;
}
cout << "greska\n";
continue;
}
string l;
cin >> l;
vector <int> v1;
bool tr = 0;
while(1){
cin >> l;
if(l == ";") break;
if(m[l] == 0) tr = 1;
v1.push_back(m[l]);
}
if(tr == 1){
m[s] = 0;
cnt--;
cout << "greska\n";
continue;
}
tr = 0;
for(int j = 1; j <= cnt; j++){
int cn = 0;
for(auto j1 : v1){
cn += a[j][j1];
}
if(cn >= 2){
tr = 1;
break;
}
}
// if(tr == 1){
// m[s] = 0;
// cnt--;
// cout << "greska\n";
// continue;
// }
// for(auto j : v1){
// if(j == m[s]) continue;
// a[j][m[s]] = 1;
// }
cout << "ok\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
102 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |