QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394662 | #1371. Missing Number | KareemEssam# | WA | 1ms | 3852kb | C++20 | 1.7kb | 2024-04-20 17:20:38 | 2024-04-20 17:20:38 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
template<typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long double ld;
#define lmao ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 1e5 + 5 , M = 1e4+5 , MOD = 1e9 + 7, LOG = 20 , Msk = 21 , pw1 = 31 , pwe2 = 37 ;
void testCase() {
int n;
cin >> n;
string s , curTurn = "1";
cin >> s;
for(int i = 0 ; i < s.size() ; i++){
ll cur = stol(curTurn);
if(curTurn.size() == 1){
if(s[i] != curTurn[0])
return cout << curTurn , void();
}else if(curTurn.size() == 2){
if(i + 1 < s.size()){
if(s[i] == curTurn[0] && s[i + 1] == curTurn[1])
i++;
else
return cout << cur , void();
}else
return cout << cur , void();
}else if(curTurn.size() == 3){
if(i + 2 < s.size()){
if(s[i] == curTurn[0] && s[i + 1] == curTurn[1] && s[i + 2] == curTurn[2])
i+=2;
else
return cout << cur , void();
}else
return cout << cur , void();
}
ll tmp = stol(curTurn);
tmp++;
curTurn = to_string(tmp);
}
}
signed main() {
lmao
int t = 1;
// cin >> t;
while (t--)
testCase();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3852kb
input:
2 1
output:
result:
wrong answer 1st lines differ - expected: '2', found: ''