QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789369#9810. Obliviate, Then Reincarnatejdyt11Compile Error//C++231.7kb2024-11-27 20:04:592024-11-27 20:05:00

Judging History

This is the latest submission verdict.

  • [2024-11-27 20:05:00]
  • Judged
  • [2024-11-27 20:04:59]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ll long long
#define inf 0x3f3f3f3f
#define ull unsigned long long
#define pll pair<ll,ll>
#define ls d*2
#define rs d*2+1
#define mid (l+r)/2
#define lowbit(x) (x&(-x))
//#define endl "\n"
#define all(x) x.begin(),x.end()
#define int long long
//mt19937 seed;
//uniform_int_distribution<int>num(0,2e9);
const int N=1e6+10;
const int M=33;


int n,m,q;
vector<pii>e[N];
vector<int>scc[N];
int cnt,id[N];
bool insta[N];
stack<int>s;
int low[N],dfn[N],dep;
bool is[N],ans[N];
int dis[N];
void tarjan(int u){
	dfn[u]=low[u]=++dep;
	s.push(u);
	insta[u]=1;
	for(auto [v,w]:e[u]){
		if(!dfn[v]){
			dis[v]=dis[u]+w;
			tarjan(v);
			low[u]=min(low[u],low[v]);
		}
		else if(insta[v]){
			low[u]=min(low[u],dfn[v]);
			if(dis[v]!=dis[u]+w)dp[v]=1;
		}
		dp[u]|=dp[v];
	}
	if(dfn[u]==low[u]){
		int y;
		cnt++;
		int tot=0;
		while(1){
			y=s.top();
			s.pop();
			insta[y]=0;
			tot++;
			id[y]=cnt;
			dp[y]|=dp[u];
			if(u==y)break;
		}
	}
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int _=1;//cin>>_;
    while(_--){
    	cin>>n>>m>>q;
    	int temp=1e10;
    	for(int i=0;i<m;i++){
    		int a,b;
    		cin>>a>>b;
    		if(b==0)continue;
    		int u=a+temp*n;
    		u%=n;
    		if(u==0)u=n;
    		int v=a+b+temp*n;
    		v%=n;
    		if(v==0)v=n;
    		if(u==v){
    			is[u]=1;
    			continue;
			}
    		e[u].push_back({v,b});
		}
		for(int i=1;i<=n;i++)if(!dfn[i])tarjan(i);
		while(q--){
			int x;
			cin>>x;
			x=x+temp*n;
			x%=n;
			if(x==0)x=n;
			if(dp[x])cout<<"Yes"<<endl;
			else cout<<"No"<<endl;
		}		
    }
}

详细

answer.code: In function ‘void tarjan(long long int)’:
answer.code:42:45: error: ‘dp’ was not declared in this scope; did you mean ‘dup’?
   42 |                         if(dis[v]!=dis[u]+w)dp[v]=1;
      |                                             ^~
      |                                             dup
answer.code:44:17: error: ‘dp’ was not declared in this scope; did you mean ‘dup’?
   44 |                 dp[u]|=dp[v];
      |                 ^~
      |                 dup
answer.code:56:25: error: ‘dp’ was not declared in this scope; did you mean ‘dup’?
   56 |                         dp[y]|=dp[u];
      |                         ^~
      |                         dup
answer.code: In function ‘int main()’:
answer.code:91:28: error: ‘dp’ was not declared in this scope; did you mean ‘dup’?
   91 |                         if(dp[x])cout<<"Yes"<<endl;
      |                            ^~
      |                            dup