QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227876 | #7606. Digital Nim | ucup-team2230# | WA | 586ms | 3772kb | C++23 | 1.3kb | 2023-10-28 01:38:09 | 2023-10-28 01:38:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
#define eb emplace_back
#define rng(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,b) rng(i,0,b)
using ll=long long;
using P=pair<int,int>;
#define tct template<class t>
#define tctu template<class t,class u>
tct using vc=vector<t>;
tctu bool chmax(t&a,u b){if(a<b){a=b;return 1;}return 0;}
tctu bool chmin(t&a,u b){if(a>b){a=b;return 1;}return 0;}
int dp[1000010];
ll k(ll a){
ll ret=0;
while(a>0){
ret+=a%10;
a/=10;
}
return ret;
}constexpr int B = 37200;
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
int T;
cin>>T;
rep(t,T){
ll n;
cin>>n;
ll r=n/B*B;
dp[0]=1;
for(ll i=n-n%B+1;i<=n;i++){
if(i%10!=0){
dp[i-r]=0;
continue;
}
ll x=k(i);
dp[i-r]=1;
for(ll j=i-1;j>=i-x;j--){
if(dp[j-r]==1){ dp[i-r]=0; break; }
}
}
if(dp[n-r])cout<<"Bajtek"<<endl;
else cout<<"Algosia"<<endl;
}
/*int pre_B=0;
dp[0]=1;
for(int i=1;i<=100000000;i++){
//int x=k(i*10)/10;
int x=k(i);
int sum=0;
for(int j=i-x;j<=i-1;j++){
sum+=dp[j];
}
if(sum>0)dp[i]=0;
else dp[i]=1;
if(dp[i]>0){
//cerr<<i<<" "<<i-pre_B<<endl;
pre_B=i;
}
if(i%18000==0){
if(dp[i]==0)cerr<<"NG:"<<i<<endl; //cerr<<dp[i]<<endl;
}
if(i%1000000==0)cerr<<"OK:<"<<i<<endl;
}*/
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
4 1 10 42 190
output:
Algosia Bajtek Algosia Algosia
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1 1
output:
Algosia
result:
ok single line: 'Algosia'
Test #3:
score: 0
Accepted
time: 98ms
memory: 3592kb
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:
ok 10000 lines
Test #4:
score: 0
Accepted
time: 442ms
memory: 3772kb
input:
10000 86 385 545 561 563 770 831 859 1123 1218 1423 1437 1602 1650 1884 1960 2096 2160 2330 2552 2662 2762 3359 3382 3425 3556 3606 3669 3790 3962 3980 4009 4060 4128 4418 4424 4458 4483 4510 4540 4594 4659 4704 4766 4822 4946 5073 5139 5195 5225 5267 5390 5490 5557 5885 6171 6235 6307 6371 6442 645...
output:
Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Bajtek Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia...
result:
ok 10000 lines
Test #5:
score: -100
Wrong Answer
time: 586ms
memory: 3764kb
input:
10000 63282 121076 318636 395380 405847 473533 850891 859227 876990 877183 1202581 1360154 1416399 1450189 1603717 1618175 1636686 1648221 1649807 1652127 1714183 1730743 1766595 1813769 1883327 1909563 2033458 2034831 2054278 2365137 2398438 2431649 2544385 2591344 2781989 2799879 2946371 3081362 3...
output:
Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Bajtek Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algosia Algos...
result:
wrong answer 1996th lines differ - expected: 'Bajtek', found: 'Algosia'