답안 #68247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68247 2018-08-16T09:50:56 Z Talant 장난감 기차 (IOI17_train) C++17
0 / 100
1282 ms 25056 KB
#include "train.h"
//#include "grader.cpp"

#include <bits/stdc++.h>

#define mk make_pair
#define sc second
#define fr first
#define pb push_back

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

int pr[N];
bool f[N];
bool was[N];

vector <int> g[N],res;

void dfs (int e,int v) {
      was[v] = 1;
      for (auto to : g[v]) {
            if (!was[to]) {
                  pr[to] = v;
                  dfs(e,to);
            }
            else if (was[to] && to == e) {
                  f[to] = 1,f[v] = 1;
            }
            f[v] |= f[to];
      }
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	for (int i = 0; i < u.size(); i ++)
            g[u[i]].pb(v[i]);
      for (int i = 0; i < a.size(); i ++)
            res.pb(0);

      for (int i = 0; i < r.size(); i ++) {
            if (r[i]) {
                  for (int j = 0; j < r.size(); j ++)
                        was[j] = 0,f[j] = 0;
                  dfs(i,i);
                  for (int j = 0; j < r.size(); j ++) {
                        res[j] |= f[j];
                  }
            }
      }
      return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:36:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i ++)
                  ~~^~~~~~~~~~
train.cpp:38:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < a.size(); i ++)
                       ~~^~~~~~~~~~
train.cpp:41:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < r.size(); i ++) {
                       ~~^~~~~~~~~~
train.cpp:43:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++)
                                   ~~^~~~~~~~~~
train.cpp:46:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   for (int j = 0; j < r.size(); j ++) {
                                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 229 ms 24568 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 24568 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 24732 KB Output is correct
2 Correct 105 ms 24748 KB Output is correct
3 Correct 128 ms 24916 KB Output is correct
4 Incorrect 469 ms 25056 KB 3rd lines differ - on the 13th token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1282 ms 25056 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 25056 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 229 ms 24568 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -