QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#797808#9810. Obliviate, Then Reincarnateucup-team4975WA 0ms3808kbC++141.7kb2024-12-03 18:54:212024-12-03 18:54:21

Judging History

This is the latest submission verdict.

  • [2024-12-03 18:54:21]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3808kb
  • [2024-12-03 18:54:21]
  • Submitted

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
    cerr << setw(4) << #x << ":: "; \
    for (auto i : x)                \
        cerr << i << " ";           \
    cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
    out << x.fir << " " << x.sec << endl;
    return out;
}

const int mod = 998244353;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 200020;

void solve()
{
    int n,m,q;
	cin>>n>>m>>q;
	vector<vector<ll>> G(n+1,vector<ll>());
	for(int i=0;i<m;i++){
		ll a,b;
		cin>>a>>b;
		a=((a%n)+n)%n;
		if(b!=0)G[a].push_back(b);
	}
	vector<bool> ans(n,0);
	vector<int> vis(n,0);
	function<bool(ll,ll)> dfs=[&](ll x,ll d){
		if(vis[x]==1){
			return (bool)ans[x];
		}
		else if(vis[x]==2){
			if(d!=x)return true;
			else return false;
		}
		vis[x]=2;
		bool res=false;
		for(ll y:G[x]){
			res|=dfs((((x+d)%n)+n)%n,x+d);
		}
		vis[x]=1;
		ans[x]=res;
		return res;
	};
	for(int i=0;i<n;i++)dfs(i,i);
	while(q--){
		ll x;
		cin>>x;
		x=((x%n)+n)%n;
		if(ans[x])cout<<"Yes\n";
		else cout<<"No\n";
	}
	return;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

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: 3580kb

input:

3 2 3
1 1
-1 0
1
2
3

output:

No
No
No

result:

ok 3 tokens

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3808kb

input:

1 1 1
0 1000000000
-1000000000

output:

No

result:

wrong answer 1st words differ - expected: 'Yes', found: 'No'