# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
831779 |
2023-08-20T14:26:03 Z |
QwertyPi |
Prize (CEOI22_prize) |
C++14 |
|
211 ms |
10348 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 11;
const int MAXK = 1e5 + 11;
int N, K, Q, T;
int p1[MAXN], p2[MAXN];
int p[MAXK], q[MAXK];
void read_input(){
cin >> N >> K >> Q >> T;
for(int i = 1; i <= N; i++) cin >> p1[i];
for(int i = 1; i <= N; i++) cin >> p2[i];
for(int i = 1; i <= K; i++) cout << i << " \n"[i == K];
cout.flush();
}
struct bump{
int l, r;
};
bump r1[MAXK], r2[MAXK];
bump operator+ (const bump& a, const bump& b){
if(a.r >= b.l){
return {a.l, a.r - b.l + b.r};
}else{
return {a.l - a.r + b.l, b.r};
}
}
void query(int a, int b){
cout << "? " << a << ' ' << b << '\n';
}
void done_query(){
cout << "!" << '\n'; cout.flush();
}
pair<bump, bump> read_query_answer(int a, int b){
int a1, b1, a2, b2; cin >> a1 >> b1 >> a2 >> b2;
return {{a1, b1}, {a2, b2}};
}
int dist(int p, int q, bump a[]){
bump b {0, 0};
for(int i = p; i < q; i++){
b = b + a[i];
}
return b.l + b.r;
}
int32_t main(){
cin.tie(0); cout.tie(0)->sync_with_stdio(false);
read_input();
for(int i = 1; i <= K - 1; i++){
query(i, i + 1);
}
done_query();
for(int i = 1; i <= K - 1; i++){
auto q = read_query_answer(i, i + 1);
r1[i] = q.first, r2[i] = q.second;
}
for(int i = 0; i < T; i++){
cin >> p[i] >> q[i]; if(p[i] > q[i]) swap(p[i], q[i]);
}
for(int i = 0; i < T; i++){
int d1 = dist(p[i], q[i], r1);
int d2 = dist(p[i], q[i], r2);
cout << d1 << ' ' << d2 << '\n';
}
cout.flush();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
134 ms |
6036 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
149 ms |
6412 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
69 ms |
4524 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
208 ms |
8896 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
211 ms |
10348 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |