제출 #1028492

#제출 시각아이디문제언어결과실행 시간메모리
1028492pcc저울 (IOI15_scales)C++17
14.29 / 100
1 ms432 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; const int N = 6; vector<int> paths[N+1]; int deg[N+1]; void init(int T) { } vector<int> topo(){ queue<int> q; for(int i = 1;i<=N;i++){ if(!deg[i])q.push(i); } vector<int> re; assert(q.size() == 1); while(!q.empty()){ auto now = q.front(); q.pop(); re.push_back(now); for(auto nxt:paths[now]){ deg[nxt]--; if(!deg[nxt])q.push(nxt); } } return re; } void orderCoins() { /* ... */ memset(deg,0,sizeof(deg)); for(auto &i:paths)i.clear(); for(int i = 1;i<=N;i++){ for(int j = i+1;j<=N;j++){ for(int k = j+1;k<=N;k++){ int mx = getHeaviest(i,j,k); if(i != mx)deg[i]++,paths[mx].push_back(i); if(j != mx)deg[j]++,paths[mx].push_back(j); if(k != mx)deg[k]++,paths[mx].push_back(k); } } } auto tmp = topo(); assert(tmp.size() == N); int a = tmp.end()[-1],b = tmp.end()[-2];tmp.pop_back();tmp.pop_back(); if(getLightest(a,b,tmp[0]) == a){ tmp.push_back(b); tmp.push_back(a); } else{ tmp.push_back(a); tmp.push_back(b); } reverse(tmp.begin(),tmp.end()); int ans[N] = {}; for(int i = 0;i<N;i++)ans[i] = tmp[i]; answer(ans); return; }

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

scales.cpp: In function 'void init(int)':
scales.cpp:10:15: warning: unused parameter 'T' [-Wunused-parameter]
   10 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...