제출 #495960

#제출 시각아이디문제언어결과실행 시간메모리
495960AlperenTChecker (COCI19_checker)C++17
29 / 110
3012 ms30176 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int t, n, a, b, c; string str; vector<pair<int, int>> graph[N]; vector<array<int, 3>> edges; priority_queue<int, vector<int>, greater<int>> pq; bool flag1 = true, flag2 = true; bool check(int nodea, int nodeb, int c){ vector<pair<int, int>> v, va, vb; va = graph[nodea]; vb = graph[nodeb]; int a = 0, b = 0; while(a < va.size() && b < vb.size()){ if(va[a].first == vb[b].first){ v.push_back({va[a].second, vb[b].second}); a++, b++; } else if(va[a].first < vb[b].first) a++; else if(vb[b].first < va[a].first) b++; } for(auto p : v){ if(p.first != p.second && p.first != c && p.second != c) continue; else return false; } return true; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> t >> n; cin >> str; str = '$' + str; for(int i = 1; i <= n - 1; i++){ edges.push_back({i, i + 1, str[i] - '0'}); edges.push_back({i + 1, i, str[i] - '0'}); } edges.push_back({n, 1, str[n] - '0'}); edges.push_back({1, n, str[n] - '0'}); for(int i = 1; i <= n - 3; i++){ cin >> a >> b >> c; if(b < a) swap(a, b); graph[a].push_back({b, c}); edges.push_back({b, a, c}); } for(int v = 1; v <= n; v++){ while(!pq.empty() && pq.top() <= v) pq.pop(); for(auto e : graph[v]) if(!pq.empty() && e.first > pq.top()) flag1 = false; for(auto e : graph[v]) pq.push(e.first); } if(flag1){ for(auto e : edges) graph[e[0]].push_back({e[1], e[2]}); for(int v = 1; v <= n; v++) sort(graph[v].begin(), graph[v].end()); for(int v = 1; v <= n; v++){ for(auto e : graph[v]){ if(!check(v, e.first, e.second)) flag2 = false; } } } if(!flag1) cout << "neispravna triangulacija"; else{ if(!flag2) cout << "neispravno bojenje"; else cout << "tocno"; } }

컴파일 시 표준 에러 (stderr) 메시지

checker.cpp: In function 'bool check(int, int, int)':
checker.cpp:27:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     while(a < va.size() && b < vb.size()){
      |           ~~^~~~~~~~~~~
checker.cpp:27:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     while(a < va.size() && b < vb.size()){
      |                            ~~^~~~~~~~~~~
#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...