#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n>>n;
string s;
cin>>s;
int l[n]={};
vector<int> r[n];
for (int i=0;i<n-3;i++)
{
int x,y,c;
cin>>x>>y>>c;
x--,y--;
if (x>y)
swap(x,y);
l[x]++;
r[y].push_back(x);
}
for (int i=0;i<n;i++)
sort(r[i].rbegin(),r[i].rend());
stack<int> st;
for (int i=0;i<n;i++)
{
for (int i:r[i])
{
if (st.top()!=i)
{
cout<<"neispravna triangulacija"<<endl;
return 0;
}
st.pop();
}
while (l[i]--)
st.push(i);
}
cout<<"tocno"<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
124 ms |
9164 KB |
Output is correct |
2 |
Correct |
112 ms |
12256 KB |
Output is correct |
3 |
Correct |
112 ms |
12324 KB |
Output is correct |
4 |
Correct |
108 ms |
12260 KB |
Output is correct |
5 |
Correct |
106 ms |
12388 KB |
Output is correct |
6 |
Correct |
104 ms |
10408 KB |
Output is correct |
7 |
Correct |
106 ms |
15328 KB |
Output is correct |
8 |
Correct |
109 ms |
12376 KB |
Output is correct |
9 |
Correct |
106 ms |
14176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
108 ms |
9332 KB |
Output is correct |
2 |
Correct |
108 ms |
12256 KB |
Output is correct |
3 |
Incorrect |
110 ms |
12424 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |