제출 #744726

#제출 시각아이디문제언어결과실행 시간메모리
744726jiahng죄수들의 도전 (IOI22_prison)C++17
10 / 100
7 ms596 KiB
#include "prison.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; //~ #define ll int typedef long double ld; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<pi> vpi; typedef pair<pi, ll> pii; typedef set<ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i, s, e) for (int i = s; i <= int(e); ++i) #define DEC(i, s, e) for (int i = s; i >= int(e); --i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i, x) for (auto i : x) #define mem(x, i) memset(x, i, sizeof x) #define fast ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define maxn 200010 #define INF (ll)1e18 #define MOD 998244353 typedef pair<vi, int> pvi; typedef pair<int, pi> ipi; typedef vector<pii> vpii; #define DEBUG 0 typedef pair <pi,pi> pipi; typedef vector <pipi> vpipi; typedef pair <string, int> psi; std::vector<std::vector<int>> devise_strategy(int N) { vector <vi> ans; // a = 0 : last B // a = 1 : last A, off // a = 2 : last A, on FOR(a,0,2) FOR(k,0,8){ vi res(N+1); res[0] = (a != 0); // B if bit is on assert(ans.size() == k+9*a); FOR(x,1,N){ if ((1<<(8-k))&x){ if (a != 0){ // last was A, compare if (a == 1){ // B is bigger res[x] = -1; }else{ // bit is same int k2 = k+1; int a2 = 0; res[x] = k2+9*a2; } }else{ // last was B int a2 = 2; res[x] = k+9*a2; } }else{ if (a != 0){ // last was A, compare if (a == 2){ // A is bigger res[x] = -2; }else{ int k2 = k+1; int a2 = 0; res[x] = k2+9*a2; } }else{ // last was B int a2 = 1; res[x] = k + 9*a2; } } } aFOR(j, res) assert(j <= 26); ans.pb(res); } return ans; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from prison.cpp:4:
prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:50:21: warning: comparison of integer expressions of different signedness: 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |   assert(ans.size() == k+9*a);
      |          ~~~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...