# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
696324 | 2023-02-06T08:33:42 Z | Cross_Ratio | Bread First Search (CCO21_day2problem2) | C++14 | 7 ms | 9936 KB |
#include <bits/stdc++.h> using namespace std; int B[200005]; vector<int> adj[200005]; signed main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); int N, M; cin >> N >> M; int i, j; for(i=1;i<=N;i++) B[i] = i; for(i=0;i<M;i++) { int a, b; cin >> a >> b; if(a > b) swap(a, b); B[a] = max(B[a], b); adj[b].push_back(a); } int ans = 0; int l = 1, r = 2; while(r != N+1) { int mi = 1e9; for(i=l;i<r;i++) { mi = min(mi, B[i]); } if(mi == r - 1) mi++; int r2 = mi + 1; for(i=r;i<r2;i++) { if(adj[i].size()==0) ans++; } l = r, r = r2; } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 2 ms | 4948 KB | Output is correct |
4 | Runtime error | 7 ms | 9936 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 2 ms | 4948 KB | Output is correct |
4 | Runtime error | 7 ms | 9936 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 2 ms | 4948 KB | Output is correct |
4 | Runtime error | 7 ms | 9936 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |