QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499538 | #6730. Coolbits | 1DemonS1 | WA | 182ms | 5648kb | C++20 | 1.0kb | 2024-07-31 15:31:53 | 2024-07-31 15:31:53 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define ll long long
#define PII std::pair<int,int>
using namespace std;
const int maxn = 1e5 + 5;
bool cmp(PII p1, PII p2) {
if (p1.second == p2.second) return p1.first < p2.second;
return p1.second < p2.second;
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int T; cin >> T;
while (T--) {
int n; cin >> n;
vector<PII> G(n + 1);
for (int i = 1; i <= n; ++i) {
cin>>G[i].first>>G[i].second;
}
sort(G.begin() + 1, G.end(), cmp);
int m = G[1].second;
int kase = 0, temp = m;
while (temp) {
temp >>= 1;
kase++;
}
int cmpp = pow(2, kase) - 1;
for (int i = 2; i <= n; ++i) {
int mi = G[i].first & cmpp;
int size = G[i].second - G[i].first;
if (mi + size >= m) continue;
m = mi + size;
}
cout << m << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3844kb
input:
2 3 0 8 2 6 3 9 1 1 100
output:
6 100
result:
ok 2 number(s): "6 100"
Test #2:
score: -100
Wrong Answer
time: 182ms
memory: 5648kb
input:
1117 74 234256176 451122435 614716780 701954053 31102604 284818525 528763990 809400397 40637446 612671528 329403504 936190213 112402633 729525189 248142852 481053286 30877745 700834811 529884578 749041634 146522084 758550567 934650972 996096650 538751855 856147351 170918541 975066425 253153230 35361...
output:
42650888 10439883 605885728 99468424 63196707 11692710 16776650 126668027 68319700 252734494 144137157 42855333 56772757 43488868 44009818 32268396 173845856 33376285 27546345 135007650 59452364 4291990 127176435 70543107 383607068 37817926 43510327 67560240 113933075 76801656 44267229 100671964 600...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '42650888'