# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153080 | 2019-09-12T09:25:17 Z | Mercenary | Potemkin cycle (CEOI15_indcyc) | C++14 | 9 ms | 632 KB |
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> #define pb push_back #define mp make_pair #define taskname "A" using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<int,int> ii; typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; const int maxn = 1e3 + 5; bitset<maxn> s[maxn] , l[maxn]; int n , m; int u[maxn] , v[maxn]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname".INP","r")){ freopen(taskname".INP", "r",stdin); freopen(taskname".OUT", "w",stdout); } cin >> n >> m; for(int i = 0 ; i < m ; ++i){ int u , v;cin >> u >> v;--u;--v; // if(u == v)continue; ::u[i] = u;::v[i] = v; s[u].set(v , 1); s[v].set(u , 1); } for(int i = 0 ; i < n ; ++i)s[i][i] = 1; for(int i = 0 ; i < n ; ++i){ for(int j = 0 ; j < maxn ; ++j){ s[i][j] = !s[i][j]; } } for(int i = 0 ; i < m ; ++i){ l[u[i]] |= (s[v[i]]); l[v[i]] |= (s[u[i]]); } for(int i = 0 ; i < n ; ++i){ l[i] &= s[i]; } for(int i = 0 ; i < n ; ++i){ l[i].set(i , 0); for(int j = 0 ; j < maxn ; ++j){ s[i][j] = !s[i][j]; } } // for(int i = 0 ; i < n ; ++i)s[i][i] = 0; for(int i = 0 ; i < m ; ++i){ int u = ::u[i]; int v = ::v[i]; // cout << u + 1 << " " << v + 1 << endl; // cout << l[u].test(v) << " " << (l[u] & s[v]).count() << endl; // for(int j = 0 ; j < n ; ++j){ // if((l[u] & s[v]).test(j))cout << j + 1 << endl; // } // cout << endl; if((l[u] & s[v]).count() >= 1){ for(int i = 0 ; i < n ; ++i){ for(int j = 0 ; j < n ; ++j){ if(!s[i].test(v) && !s[j].test(u) && s[v].test(j) && s[i].test(u) && !s[i][j]){ return cout << i + 1 << " " << u + 1 << " " << v + 1 << " " << j + 1 , 0; } } } } } cout << "no"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Expected integer, but "no" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 380 KB | Wrong adjacency |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Wrong adjacency |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 440 KB | Wrong answer on graph without induced cycle |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 504 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 632 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 632 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 512 KB | Expected integer, but "no" found |
2 | Halted | 0 ms | 0 KB | - |