QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#591570 | #2511. Pyramid | mrkiencf# | AC ✓ | 1675ms | 394732kb | C++20 | 771b | 2024-09-26 16:31:09 | 2024-09-26 16:31:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int O = 1e4 + 5;
int n, k, a[O][O];
main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t; cin >> t;
while (t --){
cin >> n >> k;
memset(a, 0, sizeof(a));
a[0][0] = k - 1;
for (int i = 0; i < n - 1; ++ i){
for (int j = 0; j < n - 1 - i; ++ j){
int x = a[i][j];
int z = (a[i][j] + 1) / 2;;
a[i][j + 1] += z;
a[i + 1][j] += x - z;
}
}
int x = 0, y = 0;
for (int i = 1; i < n; ++ i){
if (a[x][y] & 1) x += 1;
else y += 1;
}
cout << x << "\n";
}
}
/**
**/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 44ms
memory: 394652kb
input:
2 5 1 5 2
output:
0 1
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 76ms
memory: 394732kb
input:
3 5 3 5 4 5 5
output:
2 3 2
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 1675ms
memory: 394676kb
input:
20 10000 100000000 9999 98987654 1234 5678 5000 20091234 1 100 1 101 7777 77777777 5890 98767897 106 67898765 2 4 9999 98987655 9999 98987656 9999 98987657 9999 98987658 9999 98987659 9999 98987660 9999 98987661 9999 98987662 9999 98987663 9999 98987664
output:
4931 5021 614 2506 0 0 3971 2907 50 1 4968 5044 5049 5002 4998 4984 5055 5045 4991 5037
result:
ok 20 lines