CODE FESTIVAL 2017 Final (Parallel)

Submission #1803557

Source codeソースコード

#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int D[60];

int main () {
  cin >> N;
  for (auto i = 0; i < N; ++i) {
    cin >> D[i];
  }
  int cnt[13];
  fill(cnt, cnt+13, 0);
  cnt[0] = 1;
  for (auto i = 0; i < N; ++i) {
    cnt[D[i]]++;
  }
  if (cnt[0] >= 2 || cnt[12] >= 2) {
    cout << 0 << endl;
    return 0;
  }
  for (auto i = 1; i <= 11; ++i) {
    if (cnt[i] >= 3) {
      cout << 0 << endl;
      return 0;      
    }
  }
  int res = 0;
  for (auto x = 0; x < (1 << 13); ++x) {
    set<int> S;
    for (auto i = 0; i <= 12; ++i) {
      if (cnt[i] >= 2) {
        S.insert(i);
        S.insert((24-i)%24);
      } else if (cnt[i] == 1) {
        if (((x >> i) & 1) == 1) {
          S.insert(i);
        } else {
          S.insert((24-i)%24);
        }
      }
    }
    int ans = 100;
    for (auto e : S) {
      for (auto f : S) {
        if (e != f) {
          ans = min(ans, abs(e-f));
        }
      }
    }
    res = max(res, ans);
  }
  cout << res << endl;
}

Submission

Task問題 C - Time Gap
User nameユーザ名 Kazune Takahashi
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1982 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt,sample-03.txt
All 0 / 500 sample-01.txt,sample-02.txt,sample-03.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,01-20.txt,01-21.txt,01-22.txt,01-23.txt,01-24.txt,01-25.txt,01-26.txt,01-27.txt,01-28.txt,01-29.txt,01-30.txt,01-31.txt,01-32.txt,01-33.txt,01-34.txt,01-35.txt,01-36.txt,01-37.txt,01-38.txt,01-39.txt,01-40.txt,01-41.txt,01-42.txt,01-43.txt,sample-01.txt,sample-02.txt,sample-03.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt WA
01-02.txt WA
01-03.txt WA
01-04.txt AC 1 ms 256 KB
01-05.txt AC 1 ms 256 KB
01-06.txt AC 1 ms 256 KB
01-07.txt AC 1 ms 256 KB
01-08.txt AC 8 ms 256 KB
01-09.txt AC 1 ms 256 KB
01-10.txt AC 11 ms 256 KB
01-11.txt AC 1 ms 256 KB
01-12.txt AC 1 ms 256 KB
01-13.txt AC 1 ms 256 KB
01-14.txt AC 1 ms 256 KB
01-15.txt AC 1 ms 256 KB
01-16.txt AC 1 ms 256 KB
01-17.txt WA
01-18.txt AC 3 ms 256 KB
01-19.txt AC 3 ms 256 KB
01-20.txt AC 3 ms 256 KB
01-21.txt AC 3 ms 256 KB
01-22.txt WA
01-23.txt WA
01-24.txt AC 4 ms 256 KB
01-25.txt WA
01-26.txt WA
01-27.txt AC 5 ms 256 KB
01-28.txt AC 5 ms 256 KB
01-29.txt AC 6 ms 256 KB
01-30.txt AC 6 ms 256 KB
01-31.txt AC 7 ms 256 KB
01-32.txt AC 7 ms 256 KB
01-33.txt AC 8 ms 256 KB
01-34.txt AC 10 ms 256 KB
01-35.txt AC 11 ms 256 KB
01-36.txt AC 12 ms 256 KB
01-37.txt AC 14 ms 256 KB
01-38.txt AC 15 ms 256 KB
01-39.txt AC 35 ms 256 KB
01-40.txt AC 1 ms 256 KB
01-41.txt AC 1 ms 256 KB
01-42.txt AC 1 ms 256 KB
01-43.txt AC 4 ms 256 KB
sample-01.txt AC 3 ms 256 KB
sample-02.txt AC 3 ms 256 KB
sample-03.txt AC 1 ms 256 KB