This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |