QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371802 | #7606. Digital Nim | ucup-team134 | WA | 9ms | 6272kb | C++17 | 1.4kb | 2024-03-30 16:34:47 | 2024-03-30 16:34:47 |
Judging History
answer
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
const int DS=9*18+20;
int dp[DS][DS][19]; //[last][digit sum][k]
int main(){
for(int k=0;k<19;k++){
for(int last=0;last<DS-10;last++){
for(int ds=0;ds<DS-10;ds++){
int &a=dp[ds][last][k];
if(k==0){
if(ds+1>=last){
a=last+1;
}
else{
a=1;
}
continue;
}
int tr=last;
for(int i=1;i<10;i++){
tr=dp[ds-1+i][tr][k-1];
}
a=dp[ds+1][tr][k-1];
}
}
}
int t;
scanf("%i",&t);
while(t--){
ll n;
scanf("%lld",&n);
vector<int> dig;
while(n){
dig.push_back(n%10);
n/=10;
}
int k=sz(dig)-1;
reverse(all(dig));
int tr=1;
int trSum=0;
for(auto p:dig){
for(int o=0;o<p;o++){
tr=dp[trSum][tr][k];
trSum++;
}
k--;
}
if(tr==1){
printf("Bajtek\n");
}
else{
printf("Algosia\n");
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 6ms
memory: 6092kb
input:
4 1 10 42 190
output:
Algosia Bajtek Algosia Algosia
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 9ms
memory: 6272kb
input:
1 1
output:
Algosia
result:
ok single line: 'Algosia'
Test #3:
score: -100
Wrong Answer
time: 7ms
memory: 6052kb
input:
10000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
output:
Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia...
result:
wrong answer 90th lines differ - expected: 'Bajtek', found: 'Algosia'