#include <iostream>
#include <cmath>
#include <utility>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second
vector<pair<int,pii> > arr;
vector<pii> veki[200003];
stack<int> st;
int main () {
int n,t;
cin>>t;
cin>>n;
for(int i=1;i<n;i++){
char a;
cin>>a;
int b=int(a)-48;
veki[i].push_back(mp(i+1,b));
veki[i+1].push_back(mp(n+i,b));
}
char a;
cin>>a;
int b=int(a)-48;
veki[1].push_back(mp(n,b));
veki[n].push_back(mp(n+1,b));
for(int i=1;i<=n-3;i++){
int a,b,c;
cin>>a>>b>>c;
if(a>b) swap(a,b);
veki[a].push_back(mp(b,c));
veki[b].push_back(mp(n+a,c));
arr.push_back(mp(a,mp(1,-b)));
arr.push_back(mp(b,mp(-1,-a)));
}
sort(arr.begin(),arr.end());
int tr=1;
for(int i=0;i<arr.size();i++){
if(arr[i].y.x==1) st.push(-arr[i].y.y);
else{
if(st.top()==arr[i].x) st.pop();
else{
tr=0;
break;
}
}
}
if(!tr){
cout<<"neispravna triangulacija";
return 0;
}
for(int i=1;i<=n;i++){
if(veki[i].size()) sort(veki[i].begin(),veki[i].end());
}
for(int i=1;i<=n;i++){
for(int j=0;j<veki[i].size()-1;j++){
if(veki[i][j].y==veki[i][j+1].y){
tr=0;
break;
}
}
if(!tr) break;
}
if(!tr){
cout<<"neispravno bojenje";
}
else cout<<"tocno";
return 0;
}
Compilation message
checker.cpp: In function 'int main()':
checker.cpp:47:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | for(int i=0;i<arr.size();i++){
| ~^~~~~~~~~~~
checker.cpp:65:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | for(int j=0;j<veki[i].size()-1;j++){
| ~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4992 KB |
Output is correct |
2 |
Correct |
4 ms |
4992 KB |
Output is correct |
3 |
Correct |
4 ms |
4992 KB |
Output is correct |
4 |
Correct |
4 ms |
4992 KB |
Output is correct |
5 |
Correct |
4 ms |
4992 KB |
Output is correct |
6 |
Correct |
4 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4992 KB |
Output is correct |
2 |
Correct |
4 ms |
4992 KB |
Output is correct |
3 |
Correct |
4 ms |
4992 KB |
Output is correct |
4 |
Correct |
4 ms |
4992 KB |
Output is correct |
5 |
Correct |
4 ms |
4992 KB |
Output is correct |
6 |
Correct |
4 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
7 ms |
5248 KB |
Output is correct |
9 |
Correct |
7 ms |
5248 KB |
Output is correct |
10 |
Correct |
7 ms |
5248 KB |
Output is correct |
11 |
Correct |
7 ms |
5248 KB |
Output is correct |
12 |
Correct |
7 ms |
5248 KB |
Output is correct |
13 |
Correct |
7 ms |
5248 KB |
Output is correct |
14 |
Correct |
7 ms |
5248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
530 ms |
26024 KB |
Output is correct |
2 |
Correct |
525 ms |
26140 KB |
Output is correct |
3 |
Correct |
504 ms |
26028 KB |
Output is correct |
4 |
Correct |
501 ms |
25948 KB |
Output is correct |
5 |
Correct |
500 ms |
25880 KB |
Output is correct |
6 |
Correct |
533 ms |
25880 KB |
Output is correct |
7 |
Correct |
537 ms |
26180 KB |
Output is correct |
8 |
Correct |
495 ms |
25608 KB |
Output is correct |
9 |
Correct |
494 ms |
25880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
527 ms |
26012 KB |
Output is correct |
2 |
Correct |
529 ms |
26236 KB |
Output is correct |
3 |
Correct |
532 ms |
26136 KB |
Output is correct |
4 |
Correct |
528 ms |
26008 KB |
Output is correct |
5 |
Correct |
524 ms |
26076 KB |
Output is correct |
6 |
Correct |
541 ms |
26264 KB |
Output is correct |
7 |
Correct |
550 ms |
26264 KB |
Output is correct |
8 |
Correct |
534 ms |
26264 KB |
Output is correct |
9 |
Correct |
532 ms |
26136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4992 KB |
Output is correct |
2 |
Correct |
4 ms |
4992 KB |
Output is correct |
3 |
Correct |
4 ms |
4992 KB |
Output is correct |
4 |
Correct |
4 ms |
4992 KB |
Output is correct |
5 |
Correct |
4 ms |
4992 KB |
Output is correct |
6 |
Correct |
4 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
7 ms |
5248 KB |
Output is correct |
9 |
Correct |
7 ms |
5248 KB |
Output is correct |
10 |
Correct |
7 ms |
5248 KB |
Output is correct |
11 |
Correct |
7 ms |
5248 KB |
Output is correct |
12 |
Correct |
7 ms |
5248 KB |
Output is correct |
13 |
Correct |
7 ms |
5248 KB |
Output is correct |
14 |
Correct |
7 ms |
5248 KB |
Output is correct |
15 |
Correct |
530 ms |
26024 KB |
Output is correct |
16 |
Correct |
525 ms |
26140 KB |
Output is correct |
17 |
Correct |
504 ms |
26028 KB |
Output is correct |
18 |
Correct |
501 ms |
25948 KB |
Output is correct |
19 |
Correct |
500 ms |
25880 KB |
Output is correct |
20 |
Correct |
533 ms |
25880 KB |
Output is correct |
21 |
Correct |
537 ms |
26180 KB |
Output is correct |
22 |
Correct |
495 ms |
25608 KB |
Output is correct |
23 |
Correct |
494 ms |
25880 KB |
Output is correct |
24 |
Correct |
527 ms |
26012 KB |
Output is correct |
25 |
Correct |
529 ms |
26236 KB |
Output is correct |
26 |
Correct |
532 ms |
26136 KB |
Output is correct |
27 |
Correct |
528 ms |
26008 KB |
Output is correct |
28 |
Correct |
524 ms |
26076 KB |
Output is correct |
29 |
Correct |
541 ms |
26264 KB |
Output is correct |
30 |
Correct |
550 ms |
26264 KB |
Output is correct |
31 |
Correct |
534 ms |
26264 KB |
Output is correct |
32 |
Correct |
532 ms |
26136 KB |
Output is correct |
33 |
Correct |
540 ms |
26004 KB |
Output is correct |
34 |
Correct |
529 ms |
26008 KB |
Output is correct |
35 |
Correct |
502 ms |
26012 KB |
Output is correct |
36 |
Correct |
491 ms |
25880 KB |
Output is correct |
37 |
Correct |
522 ms |
26008 KB |
Output is correct |
38 |
Correct |
524 ms |
25880 KB |
Output is correct |
39 |
Correct |
521 ms |
26008 KB |
Output is correct |
40 |
Correct |
546 ms |
25972 KB |
Output is correct |
41 |
Correct |
546 ms |
26524 KB |
Output is correct |
42 |
Correct |
497 ms |
25640 KB |
Output is correct |
43 |
Correct |
538 ms |
26008 KB |
Output is correct |