# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
229826 |
2020-05-06T19:17:13 Z |
edsa |
CATS (NOI14_cats) |
C++17 |
|
86 ms |
2296 KB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;
ll n, l, x, t, arr[MAXN];
ll f(ll n, ll l, ll x) {
vi s1;
ll s2 = 0;
ll c = 0;
while (x > 0) {
if (s1.empty())
s1.push_back(c);
s2 = s1.back();
s1.pop_back();
for (auto& v : s1) {
v ^= 1;
}
c ^= 1;
if (s2 > l) {
if (--x == 0) {
return s2;
}
} else {
s2 += 2*n;
s1.push_back(s2);
s1.push_back(s2);
}
}
return 0;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> t;
while (t--) {
cin >> x >> l >> n;
// cerr << f(n, l, x) << "\n";
n<<=1;
ll k = l/n+1;
ll zeros = k+2+(k&1);
if (k <= 60)
x = x&((1<<(k+1))-1);
zeros -= __builtin_popcountll(x-1);
cout << k*n+(zeros&1) << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
496 KB |
Output is correct |
2 |
Incorrect |
10 ms |
444 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
2296 KB |
Output is correct |
2 |
Incorrect |
86 ms |
2296 KB |
Output isn't correct |