QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61553#1371. Missing NumberSilverhorse7#WA 4ms3328kbC++20798b2022-11-14 05:48:152022-11-14 05:48:18

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-14 05:48:18]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3328kb
  • [2022-11-14 05:48:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N =2e5;
signed main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int mex =1;
	int curMove=1;
	for(int i = 0 ;  i  <s.size();i++){
		if(curMove==1){
			if((s[i]-'0')!=mex){return cout<<mex , 0;}
				}
		else if (curMove==2){
			string tmp;
			tmp+=s[i];
			if(i+1 >=s.size()){
				return cout<<mex,0;
			}
			tmp+=s[i+1];
			if(stoi(tmp) !=mex) return cout<<mex, 0;
			i++;
		}
		else if (curMove==3){
			string tmp;
			tmp+=s[i];
			if(i+1 >=s.size()){
				return cout<<mex,0;
			}
			tmp+=s[i+1];
			if(i+2 >=s.size())
				return cout<<mex,0;
			tmp+=s[i+2];
			if(stoi(tmp) !=mex) return cout<<mex, 0;
			i++;
			i++;
		}
		mex++;
		if(mex>=10)curMove++;
		if(mex>=100)curMove++;
	}
	cout<<mex<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3308kb

input:

2
1

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 4ms
memory: 3236kb

input:

2
2

output:

1

result:

ok single line: '1'

Test #3:

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

input:

100
23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 3320kb

input:

100
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899

output:

11

result:

wrong answer 1st lines differ - expected: '100', found: '11'