제출 #1204330

#제출 시각아이디문제언어결과실행 시간메모리
1204330loomShuffle (NOI19_shuffle)C++20
19 / 100
1 ms584 KiB
#include "shuffle.h" #include<bits/stdc++.h> using namespace std; #define inf 5e18 #define nl '\n' #define vi vector<int> #define vvi vector<vi> int n, b, k; vector<int> solve1(){ vvi qry1(b), qry2(b); vvi res1, res2, res3, res4; vi p1(n+1), p2(n+1), p3(n+1), p4(n+1); for(int i=2, j=0; i<=n; i+=2, j++) qry1[j] = {i-1, i}; res1 = shuffle(qry1); for(auto &v : res1){ p1[v[0]] = v[1]; p1[v[1]] = v[0]; } for(int i=3, j=0; i<=n; i+=2, j++) qry2[j] = {i-1, i}; qry2[b-1] = {1, n}; res2 = shuffle(qry2); for(auto &v : res2){ p2[v[0]] = v[1]; p2[v[1]] = v[0]; } swap(qry1[0][1], qry1[1][1]); res3 = shuffle(qry1); for(auto &v : res3){ p3[v[0]] = v[1]; p3[v[1]] = v[0]; } swap(qry2[0][1], qry2[1][1]); res4 = shuffle(qry2); for(auto &v : res4){ p4[v[0]] = v[1]; p4[v[1]] = v[0]; } vi ans(n+1); for(int i=1; i<=n; i++){ if(p1[i] != p3[i] and p2[i] == p4[i]) ans[1] = i; } for(int i=1; i<=n; i+=2){ int x = p1[ans[i]]; ans[i+1] = x; if(i+2 <= n) ans[i+2] = p2[x]; } ans.erase(ans.begin()); return ans; } vector<int> solve2(){ } vector<int> solve(int N, int B, int K, int Q, int ST){ n = N; b = B; k = K; if(k == 2) return solve1(); else return solve2(); }

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

shuffle.cpp: In function 'std::vector<int> solve2()':
shuffle.cpp:62:1: warning: no return statement in function returning non-void [-Wreturn-type]
   62 | }
      | ^
#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...