Submission #877545

#TimeUsernameProblemLanguageResultExecution timeMemory
877545danikoynovSweeping (JOI20_sweeping)C++14
1 / 100
18075 ms31100 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...