제출 #301815

#제출 시각아이디문제언어결과실행 시간메모리
301815TMJN전선 연결 (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; long long min_total_length(vector<int>r,vector<int>b) vector<pair<long long,bool>>V; for(int i:r){ V.push_back({i,0}); } for(int i:b){ V.push_back({i,1}); } sort(V.begin(),V.end()); long long l[2]; int N=V.size(); l[0]=l[1]=-0xE869120E869120; vector<vector<long long>>DP(N+1,vector<long long>(1<<7,0xE869120E869120)); for(int i=0;i<10;i++){ V.push_back({0xE869120E869120,i&1}); } DP[0][0]=0; for(int i=0;i<N;i++){ for(int j=0;j<(1<<7);j++){ if(j&1){ DP[i+1][j/2]=min(DP[i+1][j/2],DP[i][j]); } else{ DP[i+1][j/2]=min(DP[i+1][j/2],DP[i][j]+V[i].first-l[!V[i].second]); for(int k=1;k<7;k++){ if(V[i].second!=V[i+k].second){ int t=(j|(1<<k)); t/=2; DP[i+1][t]=min(DP[i+1][t],DP[i][j]+V[i+k].first-V[i].first); } } } } l[V[i].second]=V[i].first; } return DP[N][0]; }

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

wiring.cpp:6:2: error: expected initializer before 'vector'
    6 |  vector<pair<long long,bool>>V;
      |  ^~~~~~
wiring.cpp:7:2: error: expected unqualified-id before 'for'
    7 |  for(int i:r){
      |  ^~~
wiring.cpp:10:2: error: expected unqualified-id before 'for'
   10 |  for(int i:b){
      |  ^~~
wiring.cpp:13:6: error: expected constructor, destructor, or type conversion before '(' token
   13 |  sort(V.begin(),V.end());
      |      ^
wiring.cpp:15:8: error: 'V' was not declared in this scope
   15 |  int N=V.size();
      |        ^
wiring.cpp:16:2: error: 'l' does not name a type
   16 |  l[0]=l[1]=-0xE869120E869120;
      |  ^
wiring.cpp:18:2: error: expected unqualified-id before 'for'
   18 |  for(int i=0;i<10;i++){
      |  ^~~
wiring.cpp:18:14: error: 'i' does not name a type
   18 |  for(int i=0;i<10;i++){
      |              ^
wiring.cpp:18:19: error: 'i' does not name a type
   18 |  for(int i=0;i<10;i++){
      |                   ^
wiring.cpp:21:2: error: 'DP' does not name a type
   21 |  DP[0][0]=0;
      |  ^~
wiring.cpp:22:2: error: expected unqualified-id before 'for'
   22 |  for(int i=0;i<N;i++){
      |  ^~~
wiring.cpp:22:14: error: 'i' does not name a type
   22 |  for(int i=0;i<N;i++){
      |              ^
wiring.cpp:22:18: error: 'i' does not name a type
   22 |  for(int i=0;i<N;i++){
      |                  ^
wiring.cpp:40:2: error: expected unqualified-id before 'return'
   40 |  return DP[N][0];
      |  ^~~~~~
wiring.cpp:41:1: error: expected declaration before '}' token
   41 | }
      | ^