# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
798811 | 2023-07-31T04:36:46 Z | tlnk07 | Cijanobakterije (COCI21_cijanobakterije) | C++17 | 41 ms | 336 KB |
#include<bits/stdc++.h> using namespace std; long long n, chk = 0, m, cnt = 0, x, y, cnt1 = 0, cnt2 = 0; bool check[100001]; int main() { cin >> n >> m; if(n == 1) { cout << 1; return 0; } for(int i = 1; i <= n; ++i) { cin >> x >> y; if(x > 2) chk = 1; if(!check[x]) ++cnt; if(!check[y]) ++cnt; if(x == 1 && !check[y] && y != 2) ++cnt1; else if(x == 2 && !check[y] && y != 1) ++cnt2; check[x] = check[y] = true; } if(!chk) { if(cnt1 > 1 && cnt2 > 1) cout << 6; else if(cnt1 > 1 && cnt2 == 1 || cnt2 > 1 && cnt1 == 1) cout << 5; else if(cnt1 == 0) { if(cnt2 > 1) cout << 4; else if(cnt2 == 1) cout << 3; else cout << 2; } else if(cnt2 == 0) { if(cnt1 > 1) cout << 4; else if(cnt2 == 1) cout << 3; else cout << 2; } } else cout << cnt; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 41 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |