제출 #980304

#제출 시각아이디문제언어결과실행 시간메모리
980304dyc123새로운 문제 (POI13_mor)C++14
100 / 100
1242 ms102400 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int INF = 10001; void solve() { int n, m, k; cin >> n >> m >> k; vector<int> adj[n]; for(int i = 0; i < m; i++) { int a, b; cin >> a >> b; adj[--a].push_back(--b); adj[b].push_back(a); } short dist[n][n][2]; memset(dist, 0x3f, sizeof(dist)); for(int i = 0; i < n; i++) { queue<array<int, 2>> q; q.push({i, 0}); dist[i][i][0] = 0; while(!q.empty()) { auto [u, p] = q.front(); q.pop(); for(int v: adj[u]) { if(dist[i][v][p ^ 1] < INF) continue; dist[i][v][p ^ 1] = dist[i][u][p] + 1; q.push({v, p ^ 1}); } } } while(k--) { int a, b, c; cin >> a >> b >> c; --a; --b; if(dist[a][b][c & 1] > INF || dist[a][b][c & 1] > c || (a == b && adj[a].size() == 0)) { cout << "NIE" << '\n'; } else { cout << "TAK" << '\n'; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); // freopen("io.out", "w", stdout); int t = 1; // cin >> t; while(t--) solve(); return 0; }

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

mor.cpp: In function 'void solve()':
mor.cpp:23:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |             auto [u, p] = q.front();
      |                  ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...