#include<bits/stdc++.h>
using namespace std;
int const N = 2e5 + 5;
vector<int> have[N];
int instk[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, t;
cin >> t;
cin >> n;
string s;
cin >> s;
int u, v, c;
for(int i = 0; i < n - 3; i++){
cin >> u >> v >> c;
if(u > v)
swap(u, v);
have[u].push_back(v);
}
vector<int> stk;
for(int i = 1; i <= n; i++){
while(instk[i]){
if(stk.back() != i){
cout << "neispravna triangulacija\n";
return 0;
}else{
stk.pop_back();
instk[i]--;
}
}
sort(have[i].begin(), have[i].end());
for(int j = (int)have[i].size() - 1; j >= 0; j--){
stk.push_back(have[i][j]);
instk[have[i][j]]++;
}
}
cout << "tocno\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4980 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4920 KB |
Output is correct |
5 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4980 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4920 KB |
Output is correct |
5 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
9684 KB |
Output is correct |
2 |
Correct |
99 ms |
11636 KB |
Output is correct |
3 |
Correct |
81 ms |
11084 KB |
Output is correct |
4 |
Correct |
84 ms |
11424 KB |
Output is correct |
5 |
Correct |
87 ms |
11536 KB |
Output is correct |
6 |
Correct |
119 ms |
15328 KB |
Output is correct |
7 |
Correct |
63 ms |
10876 KB |
Output is correct |
8 |
Correct |
94 ms |
12228 KB |
Output is correct |
9 |
Correct |
66 ms |
10920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
9692 KB |
Output is correct |
2 |
Correct |
97 ms |
12272 KB |
Output is correct |
3 |
Incorrect |
100 ms |
12248 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
4 ms |
4980 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4920 KB |
Output is correct |
5 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |