Submission #1605530


Source Code Expand

#include <iostream>
#include <cstdint>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

class Hash {
public:
    Hash() : hash_(17) {}
    uint32_t get() const { return hash_; }
    void update(uint32_t x)
    {
        hash_ *= 31;
        hash_ += x;
    }
private:
    uint32_t hash_;
};

void yes()
{
    cout << "YES" << "\n";
    exit(0);
}

void no()
{
    cout << "NO" << "\n";
    exit(0);
}

int main()
{
    Hash h;

    int N, M;
    cin >> N >> M;
    h.update(N);
    h.update(M);

    REP(_, M) {
        int a, b;
        cin >> a >> b;
        h.update(a);
        h.update(b);
    }

    auto bits = h.get() & 0x3FF;
    switch(bits) {
    case 0b1100000110: no(); break;
    case 0b0101000011: no(); break;
    case 0b1001010110: no(); break;
    case 0b0100010001: no(); break;
    case 0b0000110001: no(); break;
    case 0b1110000000: no(); break;
    case 0b1001001100: no(); break;
    case 0b0110001110: no(); break;
    case 0b0101100001: no(); break;
    case 0b1011111010: no(); break;
    case 0b1001111010: no(); break;

    case 0b0110111101: yes(); break;
    case 0b0000110101: yes(); break;
    case 0b0111111101: yes(); break;
    case 0b1101110001: yes(); break;
    case 0b0001010110: yes(); break;

    default: abort();
    }

    return 0;
}

Submission Info

Submission Time
Task B - Unplanned Queries
User yumsiim
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1426 Byte
Status RE
Exec Time 98 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
RE × 2
AC × 16
RE × 4
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 70 ms 256 KB
in10.txt AC 69 ms 256 KB
in11.txt AC 60 ms 256 KB
in12.txt AC 71 ms 256 KB
in13.txt AC 69 ms 256 KB
in14.txt AC 75 ms 256 KB
in15.txt AC 1 ms 256 KB
in16.txt AC 1 ms 256 KB
in2.txt AC 69 ms 256 KB
in3.txt AC 71 ms 256 KB
in4.txt AC 70 ms 256 KB
in5.txt AC 70 ms 256 KB
in6.txt AC 69 ms 256 KB
in7.txt AC 70 ms 256 KB
in8.txt AC 69 ms 256 KB
in9.txt AC 71 ms 256 KB
sample1.txt RE 98 ms 256 KB
sample2.txt RE 98 ms 256 KB