//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
// #include <bits/extc++.h>
using namespace std;
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(ok, val) memset(ok, val, sizeof (ok))
#define PB push_back
#define endl '\n'
typedef long long ll;
inline int myrand(int l, int r) {
int ret = rand(); ret <<= 15; ret ^= rand();
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
return ret;
}
template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
return os<<"(" <<p.first<<", "<<p.second<<")"; }
typedef pair<int, int> ii;
template<typename T> using min_pq =
std::priority_queue<T, vector<T>, greater<T> >;
//int dx[] = {-1, +0, +1, +0};
//int dy[] = {+0, +1, +0, -1};
const int maxn = 1005;
int n, m;
bool ok[maxn][maxn];
int32_t main () {
// freopen("in", "r", stdin);
cin >> n >> m;
for(int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
ok[u][v] = ok[v][u] = 1;
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) if(j != i) {
for(int k = 1; k <= n; k++) if(k != j and k != i) {
for(int l = 1; l <= n; l++) if(l != i and l != j and l != k) {
if(ok[i][j] && ok[j][k] && ok[k][l] && !ok[i][k] && !ok[j][l]) {
cout << i << ' ' << j << ' ' << k << ' ' << l << endl;
return 0;
}
}
}
}
}
cout << "no" << endl;
}
Compilation message
indcyc.cpp: In function 'int myrand(int, int)':
indcyc.cpp:18:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
^~
indcyc.cpp:18:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
356 KB |
Output is correct |
3 |
Correct |
2 ms |
560 KB |
Output is correct |
4 |
Correct |
3 ms |
560 KB |
Output is correct |
5 |
Correct |
4 ms |
560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
560 KB |
Wrong adjacency |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
600 KB |
Wrong adjacency |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
620 KB |
Wrong adjacency |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
620 KB |
Wrong adjacency |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
876 KB |
Wrong answer on graph without induced cycle |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
876 KB |
Wrong adjacency |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
42 ms |
1596 KB |
Wrong adjacency |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
1596 KB |
Wrong adjacency |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1057 ms |
1596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |