제출 #268233

#제출 시각아이디문제언어결과실행 시간메모리
268233wdjpngSplit the Attractions (IOI19_split)C++17
0 / 100
1 ms416 KiB
#include <bits/stdc++.h> #define lint long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; const int maxn=200000; vector<int>out; bool vis[maxn]; int c=0; vector<int>val(3); vector<int>s; vector<vector<int>>E; void dfs(int i){ if(vis[i]){return;} vis[i]=true; c++; if(c<=s[0]){ out[i]=val[0]; } else if(c<=s[0]+s[1]){ out[i]=val[1]; } else{ out[i]=val[2]; } for(int w : E[i]){ dfs(w); } } vector<int> find_split(int n, int a, int b, int c, vector<int>p, vector<int> q){ vector<int>s1={a,b,c}; s=s1; sort(all(s)); out.resize(n); E.resize(n); rep(i, sizeof(p)){ E[p[i]].push_back(q[i]); E[q[i]].push_back(p[i]); } rep(i, 3){ rep(j, 3){ if(s1[i]==s[j]){ val[j]=i+1; } } } dfs(0); return out; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:4:35: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
    4 | #define rep(i,n) for(int i = 0; i < n; i++)
......
   40 |     rep(i, sizeof(p)){
      |         ~~~~~~~~~~~~               
split.cpp:40:5: note: in expansion of macro 'rep'
   40 |     rep(i, sizeof(p)){
      |     ^~~
#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...