QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#796761 | #6558. Allergen Testing | zeyu# | WA | 2ms | 3664kb | C++23 | 2.0kb | 2024-12-02 02:03:33 | 2024-12-02 02:03:34 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;
#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif
const ll mod = 1e9 + 7;
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}
void solve(){
ll n, d; cin >> n >> d;
ll ans = 1ll << 60, cur = 0;
while(d && n > 1){
chkmin(ans, (n + 1) / 3 * 2 + cur);
n = (n + 1) / 2;
d --; cur ++;
}
chkmin(ans, (n + 1) / 3 * 2 + cur);
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int tc = 1;
cin >> tc;
while(tc --){
solve();
}
}
/*
Do something instead of nothing!
Print out stuffs / study samples when you cannot find the bug!
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3664kb
input:
10000 1 1 1000000000000000000 1 1 1000000000000000000 1000000000000000000 1000000000000000000 26615519354743225 163142634 26615519354743225 163142634 26615519354743224 163142634 26615519354743226 163142634 847997831064072529 920867976 847997831064072529 920867976 847997831064072528 920867976 8479978...
output:
0 333333333333333335 0 60 55 55 55 55 60 60 60 60 58 58 58 58 57 57 57 57 59 59 59 59 59 59 59 59 56 56 56 56 52 52 52 52 60 60 60 60 57 57 57 57 58 58 58 58 59 59 59 59 60 60 60 60 55 55 55 55 54 54 54 54 58 58 58 58 60 60 60 60 57 57 57 57 58 58 58 58 60 60 60 60 55 55 55 55 57 57 57 57 55 55 55 5...
result:
wrong answer 2nd lines differ - expected: '60', found: '333333333333333335'