QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394664#1371. Missing NumberWisdomCasual#WA 0ms3836kbC++201.3kb2024-04-20 17:22:102024-04-20 17:22:11

Judging History

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

  • [2024-04-20 17:22:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3836kb
  • [2024-04-20 17:22:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ERROR ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); fileIO();
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
void fileIO(){
    #ifndef ONLINE_JUDGE
    freopen("io\\input.txt", "r", stdin);
    freopen("io\\output.txt", "w", stdout);
    #endif
}

const ll mod = 1e9 + 7, N = 2e5 + 5;

void TestCase() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool vis[n + 1] = {};
    int currentsubstr = 1;
    int cnt = 0;
    for(int i = 0; i < n;)
    {
        string current = s.substr(i, currentsubstr);
        if(currentsubstr == 1 || i == n - 1)
            vis[s[i] - '0' ] = true;
        else 
            vis[(s[i] - '0') * 10 + s[i + 1] - '0'] = true;

        if(i > 0 && s[i] - 1!= s[i - 1])
            cnt += 2;
        else
            cnt++;

        if(cnt <= 9)
            i++;
        else
            i += 2;

        if(cnt >= 9)
        currentsubstr++;
    }
    for(int i = 1; i <= n; i++)
    {
        if(!vis[i])
        {
            cout << i << '\n';
            return;
        }
    }
    
}

int main() {
    
    ERROR;

    int t = 1;
    //cin >> t;

    while(t--)
        TestCase();

}

詳細信息

Test #1:

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

input:

2
1

output:

2

result:

ok single line: '2'

Test #2:

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

input:

2
2

output:

1

result:

ok single line: '1'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3524kb

input:

100
23456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

output:

10

result:

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