Submission #877544

# Submission time Handle Problem Language Result Execution time Memory
877544 2023-11-23T09:57:16 Z danikoynov Sweeping (JOI20_sweeping) C++14
0 / 100
637 ms 60240 KB
#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();
    assert(m <= 100);
    ///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 Runtime error 6 ms 4956 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 265 ms 13908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 637 ms 60240 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 637 ms 60240 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 4956 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -