QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227847#7606. Digital Nimucup-team2230#RE 210ms7528kbC++231.3kb2023-10-28 00:56:422023-10-28 00:56:42

Judging History

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

  • [2023-10-28 00:56:42]
  • 评测
  • 测评结果:RE
  • 用时:210ms
  • 内存:7528kb
  • [2023-10-28 00:56:42]
  • 提交

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;
}
	
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/18000*18000;
		dp[0]=1;
		for(ll i=n-n%18000+1;i<=n;i++){
			if(i%10!=0){
				dp[i]=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: 3580kb

input:

4
1
10
42
190

output:

Algosia
Bajtek
Algosia
Algosia

result:

ok 4 lines

Test #2:

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

input:

1
1

output:

Algosia

result:

ok single line: 'Algosia'

Test #3:

score: 0
Accepted
time: 90ms
memory: 3748kb

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: 210ms
memory: 7528kb

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
Runtime Error

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

result: