제출 #171040

#제출 시각아이디문제언어결과실행 시간메모리
171040dndhkWorm Worries (BOI18_worm)C++14
10 / 100
2 ms376 KiB
#include <bits/stdc++.h> #define all(v) (v).begin(), (v).end() #define sortv(v) sort(all(v)) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define pb push_back #define FI first #define SE second #define lb lower_bound #define ub upper_bound #define test 1 #define TEST if(test) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; const int MOD = 1000000007; // 998244353 const int INF = 2e9; const ll INFLL = 1e18; const int MAX_N = 1; int N, M, K, Q; map<ll, int> mp; int ask(int x, int y, int z){ if(x<1 || x>N || y<1 || y>M || z<1 || z>K) return 0; ll t = (ll)x*(ll)(M+1)*(ll)(K+1)+(ll)y*(ll)(K+1)+(ll)z; if(mp[t]!=0){ return mp[t]; } printf("? %d %d %d\n", x, y, z); int ret; fflush(stdout); scanf("%d", &ret); mp[t] = ret; return ret; } void ans(int x, int y, int z){ printf("! %d %d %d\n", x, y, z); fflush(stdout); } void pro1(){ int s = 0, e = N+1, m; while(s<e){ if(s==e-1){ int t1 = ask(s, 1, 1), t2 = ask(e, 1, 1); if(t1>t2){ ans(s, 1, 1); }else{ ans(e, 1, 1); } return; } m = (s+e)/2; if(ask(m, 1, 1)<ask(m+1, 1, 1)){ s = m+1; }else{ e = m; } } ans(s, 1, 1); } int main(){ scanf("%d%d%d%d", &N, &M, &K, &Q); if(M==1 && K==1 && N==1000000){ pro1(); }else if(K==1){ }else{ } return 0; }

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

worm.cpp: In function 'int ask(int, int, int)':
worm.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &ret);
  ~~~~~^~~~~~~~~~~~
worm.cpp: In function 'int main()':
worm.cpp:71:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d", &N, &M, &K, &Q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...