QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#793185#9810. Obliviate, Then ReincarnateIGVARE 0ms16892kbC++141.5kb2024-11-29 17:31:202024-11-29 17:31:22

Judging History

This is the latest submission verdict.

  • [2024-11-29 17:31:22]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 16892kb
  • [2024-11-29 17:31:20]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define dep(i,a,b) for(int i=(a),i##_end=(b);i>=i##_end;--i)
using namespace std;
template<class T>inline T mymin(T x,T y){return x<y?x:y;}
template<class T>inline T mymax(T x,T y){return x>y?x:y;}
template <typename T>
inline void read(T &X){
    X=0;int w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=X*10+(ch^48),ch=getchar();
    if(w) X=-X;
}
const int maxn = 5e5 + 5;
//const double pi = acos(-1.0);
//const double eps = 1e-9;
//const int mo = 1e9 + 7;
int n,m,k,q;
int a[maxn],c[maxn];
int ans,tmp,cnt;
int flag;
char s[maxn];
bool ok[maxn];
vector<int>vc[maxn];
queue<int>Q;
void solve(){
    read(n);read(m);read(q);
	rep(i,0,n) ok[i] = 0;
    rep(i,1,m){
        int x,y;
		read(x);read(y);
		x = (x % n + n) % n;
		if(y == 0) continue;
		if(y % n == 0){
			ok[x] = 1;
			continue;
		}
		y %= n;
		int nxt = (x + y) % n;
		vc[nxt].emplace_back(x);
    }
	rep(i,1,n) if(ok[i]){
		Q.push(i);
		while(!Q.empty()){
			int x = Q.front();Q.pop();
			for(int v:vc[x])if(!ok[v]){
				ok[v] = 1;
				Q.push(v);
			}
		}
	}
	rep(i,1,q){
		int x;
		read(x);
		if(ok[x]) puts("Yes");
		else puts("No");
	}
    // printf("%d\n",ans);
}
int main(){
    //cin.tie(0)->sync_with_stdio(false);
    int T=1,cas=1;
    //read(T);
    while(T--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 16892kb

input:

3 2 3
1 1
-1 3
1
2
3

output:

Yes
Yes
No

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 15744kb

input:

3 2 3
1 1
-1 0
1
2
3

output:

No
No
No

result:

ok 3 tokens

Test #3:

score: -100
Runtime Error

input:

1 1 1
0 1000000000
-1000000000

output:


result: