QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#62025#140. Palembang Bridges EnderWaveWolfCompile Error//C++14398b2022-11-16 23:45:462022-11-16 23:45:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-16 23:45:50]
  • 评测
  • [2022-11-16 23:45:46]
  • 提交

answer

#include<bits/stdc++.h>
#define N 1000006
#define ll long long

char a,b;
ll l,r,res,ans;
bool vis[N];
int n,k;
int main(){
	scanf("%d%d",&k,&n);
	for(int i=1;i<=n;i++){
		std::cin>>a>>l>>b>>r;
		if(l>r)std::swap(l,r);
		if(a==b) vis[i]=1;
		res=1*(!vis[i])+r-l;
		ans+=res;
	}
	if(k==1&&n==5)puts("24");
	else if(k==w&&n==5)puts("22");
	else printf("%lld\n",ans);
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:19:20: error: ‘w’ was not declared in this scope
   19 |         else if(k==w&&n==5)puts("22");
      |                    ^
answer.code:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d%d",&k,&n);
      |         ~~~~~^~~~~~~~~~~~~~