제출 #742991

#제출 시각아이디문제언어결과실행 시간메모리
742991merlin죄수들의 도전 (IOI22_prison)C++17
60 / 100
14 ms1176 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second //https://ioi.contest.codeforces.com/group/32KGsXgiKA/contest/103877/problem/B void setIO(string name="") { cin.tie(0)->sync_with_stdio(0); if (!name.empty()) { freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } vector<vector<int>> devise_strategy(int n){ const int maxBit = 12; //int maxBit = 1; //while(1<<maxBit <= n) maxBit++; //maxBit--; vector<vector<int>> ans(2*maxBit+2,vector<int>(n+1)); for(int i = 1;i<2*maxBit+2;i++){ int cur_bit = (i)/2; for(int j = 1;j<=n;j++){ int set_b = j & (1<<cur_bit); if((set_b != 0 && i%2) || (set_b == 0 && i%2 == 0)){ //ak nechcem odpovedat ans[i][j] = 2*(cur_bit - 1); if(j & 1<<(cur_bit - 1)) ans[i][j]++; }else{ //idem odpovedat if(1 - (maxBit - cur_bit)%2){ //posledne som meral B if(i%2 == 0 && set_b){ ans[i][j] = -1; }else{ ans[i][j] = -2; } }else{ //posledne som meral A if(i%2 == 0 && set_b){ ans[i][j] = -2; }else{ ans[i][j] = -1; } } } if(ans[i][j] == 0) ans[i][j] = -1; } ans[i][0] = 1 - (maxBit - cur_bit)%2; //ans[i][0] = cur_bit; } for(int j = 1;j<=n;j++){ ans[0][j] = 2*maxBit; if(j & (1<<maxBit)) ans[0][j] ++; } ans[0][0] = 0; ans[0][1] = -1; return ans; }

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

prison.cpp: In function 'void setIO(std::string)':
prison.cpp:11:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   freopen((name+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prison.cpp:12:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   freopen((name+".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...