QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#480351 | #7618. Pattern Search | ucup-team052# | WA | 1ms | 3756kb | C++14 | 687b | 2024-07-16 14:28:04 | 2024-07-16 14:28:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9;
const int N = 2000005;
int f[N];
int getsum(ll w)
{
int res=0;
while(w) res+=w%10,w/=10;
return res;
}
int mex(vector<int> v)
{
int n=v.size();
vector<int> vis(n+5);
for(int i:v) if(i<n+5) vis[i]=1;
for(int i=0;;i++) if(!vis[i]) return i;
}
void dabiao()
{
int n=1000;
f[0]=0;
for(int i=1;i<=n;i++)
{
vector<int> res;
int w=getsum(i);
for(int j=1;j<=w;j++) res.push_back(f[i-j]);
f[i]=mex(res);
}
for(int i=1;i<=n;i++) printf("%d : %d\n",i,f[i]);
}
int main() {
#ifdef xay5421
freopen("a.in","r",stdin);
#endif
dabiao();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3756kb
input:
2 bajkaaall aal abca cba
output:
1 : 1 2 : 2 3 : 3 4 : 4 5 : 5 6 : 6 7 : 7 8 : 8 9 : 9 10 : 0 11 : 1 12 : 2 13 : 3 14 : 4 15 : 5 16 : 6 17 : 7 18 : 8 19 : 10 20 : 0 21 : 1 22 : 2 23 : 3 24 : 4 25 : 5 26 : 6 27 : 7 28 : 9 29 : 11 30 : 0 31 : 1 32 : 2 33 : 3 34 : 4 35 : 5 36 : 6 37 : 8 38 : 10 39 : 12 40 : 0 41 : 1 42 : 2 43 : 3 44 :...
result:
wrong answer 1st numbers differ - expected: '2', found: '1'