답안 #284784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284784 2020-08-28T03:18:05 Z cjoa 꿈 (IOI13_dreaming) C++11
18 / 100
34 ms 3320 KB
#include "dreaming.h"
#include <vector>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <cstdlib>

using namespace std;

typedef vector<int> VI;
typedef long long llong;

bool is_subtask4(int N, int M, int A[], int B[], int T[], VI& deg) {
   deg.assign(N, 0);
   for (int j = 0; j < M; ++j) {
      int u = A[j], v = B[j];
      ++deg[u];
      ++deg[v];
   }

   for (int u = 0; u < N; ++u)
      if (deg[u] > 1)
         return false;
   return true;
}

const llong INF = 1e18;

int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
   VI deg(N);
   if (is_subtask4(N, M, A, B, T, deg)) {
      if (N == 1)
         return 0;

      if (N == 2)
         return M == 0 ? L : T[0];

      if (M == 0)
         return 2*L;

      if (M == 1)
         return T[0] + L;

   // cerr << "N:" << N << "  M:" << M << "  L:" << L << endl;

      sort(T, T+M, greater<int>());
      llong res = T[0] + L + T[1];
      for (int j = 2; j < M; ++j) {
         res = max(res, (llong) T[j] + L + L + T[1]);
      }
      if (M < N-1) {
         res = max(res, (llong) L + L + T[1]);
      }

      return res;
   }

   assert(false);
   return 1 + rand();
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 3320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 3320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 3320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1024 KB Output is correct
2 Correct 19 ms 1536 KB Output is correct
3 Correct 16 ms 1536 KB Output is correct
4 Correct 12 ms 1536 KB Output is correct
5 Correct 16 ms 1536 KB Output is correct
6 Correct 17 ms 1536 KB Output is correct
7 Correct 13 ms 1536 KB Output is correct
8 Correct 12 ms 1536 KB Output is correct
9 Correct 15 ms 1408 KB Output is correct
10 Correct 14 ms 1536 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 2 ms 768 KB Output is correct
13 Correct 1 ms 768 KB Output is correct
14 Correct 1 ms 768 KB Output is correct
15 Correct 1 ms 768 KB Output is correct
16 Correct 1 ms 768 KB Output is correct
17 Correct 1 ms 768 KB Output is correct
18 Correct 2 ms 768 KB Output is correct
19 Correct 1 ms 768 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 3320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 34 ms 3320 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -