#include<bits/stdc++.h>
using namespace std;
const int maxm = 500100;
const int maxq = 1000100;
struct dust
{
int x, y, idx;
}d[maxm];
struct query
{
int t, p, l, a, b, idx;
}task[maxq];
int n, m, q;
void input()
{
cin >> n >> m >> q;
for (int i = 1; i <= m; i ++)
{
cin >> d[i].x >> d[i].y;
d[i].idx = i;
}
for (int i = 1; i <= q; i ++)
{
cin >> task[i].t;
if (task[i].t == 1)
cin >> task[i].p;
else
if (task[i].t == 2 || task[i].t == 3)
cin >> task[i].l;
else
{
cin >> task[i].a >> task[i].b;
d[++ m].idx = m;
task[i].idx = m;
d[m].x = task[i].a;
d[m].y = task[i].b;
}
}
}
void solve_slow()
{
for (int i = 1; i <= q; i ++)
{
if (task[i].t == 1)
{
cout << d[task[i].p].x << " " << d[task[i].p].y << endl;
}
else
if (task[i].t == 2)
{
for (int j = 1; j <= m; j ++)
{
if (d[j].x < n - task[i].l && d[j].y <= task[i].l)
d[j].x = n - task[i].l;
}
}
else
if (task[i].t == 3)
{
for (int j = 1; j <= m; j ++)
{
if (d[j].x <= task[i].l && d[j].y < n - task[i].l)
d[j].y = n - task[i].l;
}
}
else
{
d[task[i].idx].x = task[i].a;
d[task[i].idx].y = task[i].b;
}
}
}
void solve()
{
input();
///cout << "----------" << endl;
///if (m <= 2000 && q <= 5000)
solve_slow();
}
int main()
{
solve();
return 0;
}
Compilation message
sweeping.cpp: In function 'void input()':
sweeping.cpp:40:15: warning: operation on 'm' may be undefined [-Wsequence-point]
40 | d[++ m].idx = m;
| ^~~~
sweeping.cpp:40:15: warning: operation on 'm' may be undefined [-Wsequence-point]
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2652 KB |
Output is correct |
2 |
Correct |
9 ms |
2684 KB |
Output is correct |
3 |
Correct |
7 ms |
2652 KB |
Output is correct |
4 |
Correct |
14 ms |
2652 KB |
Output is correct |
5 |
Correct |
28 ms |
2500 KB |
Output is correct |
6 |
Correct |
11 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
264 ms |
13996 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
18075 ms |
31100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
18075 ms |
31100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2652 KB |
Output is correct |
2 |
Correct |
9 ms |
2684 KB |
Output is correct |
3 |
Correct |
7 ms |
2652 KB |
Output is correct |
4 |
Correct |
14 ms |
2652 KB |
Output is correct |
5 |
Correct |
28 ms |
2500 KB |
Output is correct |
6 |
Correct |
11 ms |
2652 KB |
Output is correct |
7 |
Runtime error |
264 ms |
13996 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |