Submission #873795


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;


int main()
{
  int V, E;
  int A[10], B[10];

  cin >> V >> E;
  for(int i = 0; i < E; i++) {
    cin >> A[i] >> B[i];
    --A[i], --B[i];
  }

  for(int i = 0; i < 1 << (E * 2); i++) {
    bool ok = true;
    for(int j = 0; j < V; j++) {
      int color = (i >> (A[j] * 2)) & 3;
      int color2 = (i >> (B[j] * 2)) & 3;
      ok &= color != color2;
    }
    if(ok) {
      for(int j = 0; j < V; j++) {
        cout << (int)((i >> (j * 2)) & 3) + 1 << endl;
      }
      break;
    }
  }


}

Submission Info

Submission Time
Task B - 今年の B 問題
User ei13333
Language C++14 (GCC 5.4.1)
Score 0
Code Size 575 Byte
Status
Exec Time 13 ms
Memory 384 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 200 00_sample_00, 00_sample_01, 10_manual_01, 10_manual_02, 10_manual_03, 10_manual_04, 10_manual_05, 10_manual_06, 10_manual_07, 10_manual_08, 10_manual_09, 10_manual_10, 10_manual_11, 10_manual_12, 10_manual_13, 10_manual_14, 10_manual_15, 10_manual_16
Case Name Status Exec Time Memory
00_sample_00 5 ms 384 KB
00_sample_01 4 ms 256 KB
10_manual_01 4 ms 256 KB
10_manual_02 4 ms 256 KB
10_manual_03 4 ms 256 KB
10_manual_04 4 ms 256 KB
10_manual_05 4 ms 256 KB
10_manual_06 4 ms 256 KB
10_manual_07 6 ms 256 KB
10_manual_08 13 ms 256 KB
10_manual_09 4 ms 256 KB
10_manual_10 4 ms 256 KB
10_manual_11 13 ms 256 KB
10_manual_12 13 ms 256 KB
10_manual_13 4 ms 256 KB
10_manual_14 4 ms 256 KB
10_manual_15 4 ms 256 KB
10_manual_16 4 ms 256 KB