Submission #308538

#TimeUsernameProblemLanguageResultExecution timeMemory
308538jurichhh8Checker (COCI19_checker)C++14
110 / 110
550 ms26524 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...