# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
803482 |
2023-08-03T04:35:40 Z |
박영우(#10104) |
Vera and Modern Art (CCO17_art) |
C++17 |
|
4000 ms |
19080 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 110
#define MAXS 20
#define INF 1000000000000000001
#define bb ' '
#define ln '\n'
#define Ln '\n'
#define MOD 1000000007
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int N, Q;
cin >> N >> Q;
int i;
ll a, b, c;
map<pll, ll> mp;
for (i = 1; i <= N; i++) {
cin >> a >> b >> c;
mp[pll(a, b)] += c;
}
vector<pair<pll, ll>> v;
for (auto& [a, b] : mp) v.emplace_back(a, b);
while (Q--) {
cin >> a >> b;
int i, j;
ll sum = 0;
for (i = 0; i <= 62; i++) for (j = 0; j <= 62; j++) {
if (a < (1ll << i)) continue;
if (b < (1ll << j)) continue;
ll mi, mj;
mi = 1ll << i;
mj = 1ll << j;
mi--;
mj--;
ll x, y;
x = a & mi;
y = b & mj;
x += mi + 1;
y += mj + 1;
int ind = lower_bound(v.begin(), v.end(), pair<pll, ll>(pll(x, y), 0)) - v.begin();
if (ind < v.size() && v[ind].first == pll(x, y)) sum += v[ind].second;
}
cout << sum << Ln;
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:44:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<long long int, long long int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | if (ind < v.size() && v[ind].first == pll(x, y)) sum += v[ind].second;
| ~~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
127 ms |
536 KB |
Output is correct |
3 |
Correct |
141 ms |
528 KB |
Output is correct |
4 |
Correct |
164 ms |
544 KB |
Output is correct |
5 |
Correct |
162 ms |
532 KB |
Output is correct |
6 |
Correct |
55 ms |
552 KB |
Output is correct |
7 |
Correct |
54 ms |
528 KB |
Output is correct |
8 |
Correct |
55 ms |
544 KB |
Output is correct |
9 |
Correct |
54 ms |
528 KB |
Output is correct |
10 |
Correct |
55 ms |
524 KB |
Output is correct |
11 |
Correct |
56 ms |
520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4070 ms |
19080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2783 ms |
9788 KB |
Output is correct |
3 |
Correct |
2723 ms |
9768 KB |
Output is correct |
4 |
Execution timed out |
4054 ms |
9588 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
127 ms |
536 KB |
Output is correct |
3 |
Correct |
141 ms |
528 KB |
Output is correct |
4 |
Correct |
164 ms |
544 KB |
Output is correct |
5 |
Correct |
162 ms |
532 KB |
Output is correct |
6 |
Correct |
55 ms |
552 KB |
Output is correct |
7 |
Correct |
54 ms |
528 KB |
Output is correct |
8 |
Correct |
55 ms |
544 KB |
Output is correct |
9 |
Correct |
54 ms |
528 KB |
Output is correct |
10 |
Correct |
55 ms |
524 KB |
Output is correct |
11 |
Correct |
56 ms |
520 KB |
Output is correct |
12 |
Execution timed out |
4070 ms |
19080 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |