제출 #1037631

#제출 시각아이디문제언어결과실행 시간메모리
103763112345678장난감 기차 (IOI17_train)C++17
10 / 100
640 ms1372 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; const int nx=20; int n, R[nx], A[nx]; vector<int> d[nx]; int solve(int u, vector<int> p) { int a=0, b=0; for (auto v:d[u]) { int in=0; for (int i=0; i<p.size(); i++) if (p[i]==v) in=1; if (in) { int pw=R[v]; vector<int> tmp=p; while (tmp.back()!=v) pw=pw||R[tmp.back()], tmp.pop_back(); if (pw) a++; else b++; } else { p.push_back(v); if (solve(v, p)) a++; else b++; p.pop_back(); } } if (A[u]) { if (a>0) return 1; else return 0; } else { if (b>0) return 0; else return 1; } } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { n=a.size(); vector<int> res(n); for (int i=0; i<n; i++) R[i]=r[i], A[i]=a[i]; for (int i=0; i<u.size(); i++) d[u[i]].push_back(v[i]); for (int i=0; i<n; i++) res[i]=solve(i, vector<int> {i}); return res; }

컴파일 시 표준 에러 (stderr) 메시지

train.cpp: In function 'int solve(int, std::vector<int>)':
train.cpp:17:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int i=0; i<p.size(); i++) if (p[i]==v) in=1;
      |                       ~^~~~~~~~~
train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:50:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for (int i=0; i<u.size(); i++) d[u[i]].push_back(v[i]);
      |                   ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...