QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#59655#1371. Missing Numberabdelrahman001#WA 2ms3532kbC++20887b2022-10-31 18:04:352022-10-31 18:04:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-31 18:04:35]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3532kb
  • [2022-10-31 18:04:35]
  • 提交

answer

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 1e5 + 5;
int n;
string s;
bool done[N];
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> s;
    done[0] = true;
    for(int i = 0;i < s.size();i++) {
		if(i + 2 < s.size()) {
			int cur = stoi(s.substr(i, 3));
			if(cur <= n && cur == 100) {
				i += 2;
				done[cur] = true;
				continue;
			}
		}
		if(i + 1 < s.size()) {
			int cur = stoi(s.substr(i, 2));
			if(cur <= n && !done[cur]) {
				i++;
				done[cur] = true;
				continue;
			}
		}
		done[s[i] - '0'] = true;
	}
	for(int i = 1;i <= n;i++)
		if(!done[i])
			return cout << i, 0;
    return 0;
}


詳細信息

Test #1:

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

input:

2
1

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3496kb

input:

2
2

output:

1

result:

ok single line: '1'

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3532kb

input:

100
23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

29

result:

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