답안 #1037283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037283 2024-07-28T12:40:04 Z wood Joker (BOI20_joker) C++17
0 / 100
2000 ms 10712 KB
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> p32;
typedef vector<p32> vp32;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second 

int main(){
	int n,m,q; cin>>n>>m>>q;
	vp32 adj[n];
	for(int i = 0; i<m; i++){
		int a,b; cin>>a>>b;
		a--; b--;
		adj[a].eb(b,i+1);
		adj[b].eb(a,i+1);
	}
	for(int i = 0; i<q; i++){
		int l,r; cin>>l>>r;
		int done[n];
		memset(done,0,sizeof done);
		stack<p32> qu;
		for(int i = 0; i<n; i++){
			if(!done[i]){
				qu.emplace(i,i);
				while(!qu.empty()){
					p32 x = qu.top();
					qu.pop();
					done[x.fi] = done[x.se]+1;
					for(p32 tt : adj[x.fi]){
						if(tt.se<l||tt.se>r){
							if(done[tt.fi]&&done[tt.fi]<done[x.fi]-1){
								goto found;
							}
							if(done[tt.fi]==0){
								qu.emplace(tt.fi,x.fi);
							}
						}
					}
				}
			}
		}
		cout<<"NO\n";
		continue;
found:
		cout<<"YES\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Incorrect 2 ms 432 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Incorrect 2 ms 432 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2053 ms 10712 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Incorrect 2 ms 432 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Incorrect 2 ms 432 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Incorrect 2 ms 432 KB Output isn't correct
9 Halted 0 ms 0 KB -