답안 #921044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
921044 2024-02-03T09:07:08 Z gelastropod Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 20868 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    int R, C, N, a, b, prev = -1, val = -1, T, c, d, tem;
    cin >> R >> C >> N;
    set<int> finding;
    map<int, set<int>> green;
    set<pair<int, int>> queued;
    bool done = false;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        a--, b--;
        green[a].insert(b);
        finding.insert(a);
    }
    cin >> T;
    for (int i = 0; i < T; i++)
    {
        done = false;
        cin >> a >> b >> c >> d;
        a--, b--, c--, d--;
        tem = b;
        b = a;
        a = tem;
        tem = d;
        d = c;
        c = tem;
        if (a > c || b > d)
        {
            cout << "No\n";
            continue;
        }
        while (b != d && a <= c)
        {
            if (finding.lower_bound(b) == finding.end() || *finding.lower_bound(b) != b)
            {
                cout << "No\n";
                done = true;
                break;
            }
            if (green[b].lower_bound(a) == green[b].end())
            {
                cout << "No\n";
                done = true;
                break;
            }
            a = *green[b].lower_bound(a);
            b++;
        }
        if (done)
            continue;
        if (a > c)
            cout << "No\n";
        else
            cout << "Yes\n";
    }
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:7:24: warning: unused variable 'prev' [-Wunused-variable]
    7 |     int R, C, N, a, b, prev = -1, val = -1, T, c, d, tem;
      |                        ^~~~
trampoline.cpp:7:35: warning: unused variable 'val' [-Wunused-variable]
    7 |     int R, C, N, a, b, prev = -1, val = -1, T, c, d, tem;
      |                                   ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 860 KB 200 token(s): yes count is 21, no count is 179
2 Correct 9 ms 688 KB 200 token(s): yes count is 70, no count is 130
3 Correct 5 ms 600 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 235 ms 10068 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 186 ms 10064 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 621 ms 10072 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 679 ms 10164 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 732 ms 10580 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 709 ms 10576 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 739 ms 10264 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 705 ms 10832 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 749 ms 10576 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 880 ms 19796 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 688 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 23 ms 604 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 18 ms 1388 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 16 ms 648 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 474 ms 900 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 16 ms 600 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2023 ms 20868 KB Time limit exceeded
2 Halted 0 ms 0 KB -