# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
804256 |
2023-08-03T07:41:19 Z |
이동현(#10103) |
Vera and Modern Art (CCO17_art) |
C++17 |
|
814 ms |
9592 KB |
#include <bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
using namespace std;
unordered_map<signed long long, int> srt[70];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
auto len = [&](signed long long x){
return 64 - __builtin_clzll(x);
};
int n, q;
cin >> n >> q;
signed long long A = 998244353;
signed long long B = (int)1e9 + 7;
for(int i = 0; i < n; ++i){
signed long long x, y;
int v;
cin >> x >> y >> v;
// assert(y == 1);
srt[len(x) - 1][A * x + B * y] += v;
}
for(int rep = 0; rep < q; ++rep){
signed long long x, y;
cin >> x >> y;
int ans = 0;
for(int i = 0; (1ll << i) <= x; ++i){
if(!(int)srt[i].size()) continue;
signed long long px = x % (1ll << i) + (1ll << i);
signed long long py = 1;
// ans += srt[i][A * px + B * py];
auto p = srt[i].find(A * px + B * py);
if(p != srt[i].end()){
ans += p->second;
}
}
cout << ans << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
9592 KB |
Output is correct |
2 |
Correct |
219 ms |
9536 KB |
Output is correct |
3 |
Correct |
718 ms |
8948 KB |
Output is correct |
4 |
Correct |
814 ms |
9024 KB |
Output is correct |
5 |
Correct |
397 ms |
9036 KB |
Output is correct |
6 |
Correct |
374 ms |
9080 KB |
Output is correct |
7 |
Correct |
363 ms |
9080 KB |
Output is correct |
8 |
Correct |
362 ms |
8996 KB |
Output is correct |
9 |
Correct |
419 ms |
8996 KB |
Output is correct |
10 |
Correct |
400 ms |
9000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |