| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 144266 | SamAnd | Tenis (COI19_tenis) | C++17 | 1056 ms | 6008 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct ban
{
    int x, y, z;
};
int n, q;
ban a[N], b[N];
bool cx[N], cy[N], cz[N];
bool c[N];
int stg(int x)
{
    int ans = 0;
    if (cx[x])
        ++ans;
    if (cy[x])
        ++ans;
    if (cz[x])
        ++ans;
    return ans;
}
void bil()
{
    memset(c, false, sizeof c);
    memset(cx, false, sizeof cx);
    memset(cy, false, sizeof cy);
    memset(cz, false, sizeof cz);
    int q = 0;
    int j = n + 1;
    for (int i = n; i > 1; --i)
    {
        cx[a[i].x] = true;
        if (stg(a[i].x) == 1)
            ++q;
        else if (stg(a[i].x) == 3)
            --q;
        cy[a[i].y] = true;
        if (stg(a[i].y) == 1)
            ++q;
        else if (stg(a[i].y) == 3)
            --q;
        cz[a[i].z] = true;
        if (stg(a[i].z) == 1)
            ++q;
        else if (stg(a[i].z) == 3)
            --q;
        if (q == 0)
        {
            j = i;
        }
    }
    for (int i = j; i <= n; ++i)
    {
        c[a[i].x] = true;
    }
}
int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i].x);
        b[a[i].x].x = i;
    }
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i].y);
        b[a[i].y].y = i;
    }
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i].z);
        b[a[i].z].z = i;
    }
    bil();
    while (q--)
    {
        int ty;
        scanf("%d", &ty);
        if (ty == 1)
        {
            int x;
            scanf("%d", &x);
            if (c[x] == false)
                printf("DA\n");
            else
                printf("NE\n");
        }
        else
        {
            int p, x, y;
            scanf("%d%d%d", &p, &x, &y);
            if (p == 1)
            {
                swap(a[b[x].x].x, a[b[y].x].x);
                swap(b[x].x, b[y].x);
            }
            else if (p == 2)
            {
                swap(a[b[x].y].y, a[b[y].y].y);
                swap(b[x].y, b[y].y);
            }
            else
            {
                swap(a[b[x].z].z, a[b[y].z].z);
                swap(b[x].z, b[y].z);
            }
            bil();
        }
    }
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
