답안 #877542

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
877542 2023-11-23T09:56:38 Z danikoynov 청소 (JOI20_sweeping) C++14
0 / 100
622 ms 29776 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();
    ///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]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 275 ms 13996 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 622 ms 29776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 622 ms 29776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -