제출 #1093893

#제출 시각아이디문제언어결과실행 시간메모리
1093893WjscJoker (BOI20_joker)C++14
6 / 100
22 ms9044 KiB
#include<bits/stdc++.h> using namespace std; #define pi pair<int, int> #define fi first #define se second #define all(v) v.begin(), v.end() const int N = 2e5 + 5; int n, m, q; pi edge[N]; vector<int> ad[N]; namespace sub1 { bool ok = 0; int col[N]; void dfs(int u, int c) { col[u] = c; for(auto v : ad[u]) { if(col[v] == col[u]) ok = 1; if(col[v] == -1) dfs(v, c ^ 1); } } void solve() { while(q--) { int l, r; cin >> l >> r; for(int i = 1; i <= n; ++i) ad[i].clear(); for(int i = 1; i < l; ++i) { int u, v; tie(u, v) = edge[i]; ad[u].push_back(v); ad[v].push_back(u); } for(int i = r + 1; i <= m; ++i) { int u, v; tie(u, v) = edge[i]; ad[u].push_back(v); ad[v].push_back(u); } for(int i = 1; i <= n; ++i) col[i] = -1; ok = 0; for(int i = 1; i <= n; ++i) if(col[i] == -1) dfs(i, 0); cout << (ok ? "YES\n" : "NO\n"); } } } signed main() { cin.tie(0)->sync_with_stdio(0); if(fopen("task.inp", "r")) { freopen("task.inp", "r", stdin); freopen("task.out", "w", stdout); } cin >> n >> m >> q; for(int i = 1; i <= m; ++i) { int u, v; cin >> u >> v; edge[i] = {u, v}; } if(n <= 200 && m <= 200 && q <= 200) sub1 :: solve(); }

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

Joker.cpp: In function 'int main()':
Joker.cpp:60:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     freopen("task.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Joker.cpp:61:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |     freopen("task.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...