QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#59721 | #1371. Missing Number | abdelrahman001# | WA | 2ms | 3560kb | C++20 | 869b | 2022-10-31 22:06:24 | 2022-10-31 22:06:25 |
Judging History
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;
for(int i = n;i >= 1;i--) {
string cur = to_string(i);
int sz = cur.size();
bool found = false;
for(int j = 0;j + sz <= s.size();j++) {
bool ok = true;
for(int k = j;k < j + sz;k++)
ok &= (!done[k]);
if(!ok)
continue;
string tmp = s.substr(j, sz);
if(tmp == cur) {
for(int k = j;k < j + sz;k++)
done[k] = true;
found = true;
break;
}
}
if(!found)
return cout << i, 0;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3560kb
input:
2 1
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
2 2
output:
1
result:
ok single line: '1'
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 3496kb
input:
100 23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
output:
90
result:
wrong answer 1st lines differ - expected: '1', found: '90'