# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
391761 | 2021-04-19T17:29:31 Z | ollel | Paths (BOI18_paths) | C++14 | 170 ms | 11000 KB |
#include <bits/stdc++.h> #include <bitset> #include <iostream> using namespace std; typedef vector<int> vi; typedef long long ll; #define rep(i,a,b) for(int i = a; i < b; i++) int n,m,k; vector<vi> adj; vi clr; const int maxN = 200; ll ans = 0; void get(int node, bitset<maxN> &visited, bitset<maxN> &clrs) { ans++; visited.flip(node); clrs.flip(clr[node]); // rep(i,0,10) cout << visited[i] << " "; // cout<<endl; // rep(i,0,10) cout << clrs[i] << " "; // cout << endl; rep(i,0,adj[node].size()) { // cout << visited[adj[node][i]] << " " << clrs[clr[adj[node][i]]] << endl; if ((!visited[adj[node][i]]) && (!clrs[clr[adj[node][i]]])) { get(adj[node][i], visited, clrs); } } visited.flip(node); clrs.flip(clr[node]); } int main() { cin>>n>>m>>k; adj.resize(n); clr.resize(n); rep(i,0,n) cin >> clr[i]; int x,y; rep(i,0,m) { cin>>x>>y;x--;y--; adj[x].push_back(y); adj[y].push_back(x); } bitset<maxN> visited(0), clrs(0); rep(i, 0, n) { get(i, visited, clrs); } ans-=n; cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 170 ms | 11000 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 296 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Runtime error | 170 ms | 11000 KB | Execution killed with signal 6 |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Runtime error | 53 ms | 3696 KB | Execution killed with signal 6 |
3 | Halted | 0 ms | 0 KB | - |