제출 #1127609

#제출 시각아이디문제언어결과실행 시간메모리
1127609LudisseyWorm Worries (BOI18_worm)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() using namespace std; vector<int> a; map<pair<int,pair<int,int>>,int> req; int n,m,k,q; void give_ans(int x, int y, int z){ cout << "! " << x+1 << " " << y+1 << " " << z+1 << endl; return; } int ask(int x, int y, int z){ if(req.find({x,{y,z}})!=req.end()) return req[{x,{y,z}}]; if(x<0||x>=n||y<0||y>=m||z<0||z>=k) return -1e9; cout << "? " << x+1 << " " << y+1 << " " << z+1 << endl; int ans; cin>>ans; req[{x,{y,z}}]=ans; return ans; } pair<int,pair<int,int>> grid_max(int z){ int mx=0; pair<int,int> mxI=0; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { int a=ask(j,i,z); if(mx<a){ mx=max(a,mx); mxI={j,i}; } } } return {mx,mxI}; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m >> k >> q; int l=0; int r=z-1; while(l<r){ int mid1=l+(r-l)/3; int mid2=r-(r-l)/3; int amid1=grid_max(mid1).first; int amid2=grid_max(mid2).first; if(amid1<amid2){ l=mid1+1; }else{ r=mid2-1; } } give_ans(grid_max(mid2).second.first,grid_max(mid2).second.second,l); return 0; }

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

worm.cpp: In function 'std::pair<int, std::pair<int, int> > grid_max(int)':
worm.cpp:24:23: error: conversion from 'int' to non-scalar type 'std::pair<int, int>' requested
   24 |     pair<int,int> mxI=0;
      |                       ^
worm.cpp: In function 'int main()':
worm.cpp:43:20: error: 'z' was not declared in this scope
   43 |     int l=0; int r=z-1;
      |                    ^
worm.cpp:55:23: error: 'mid2' was not declared in this scope
   55 |     give_ans(grid_max(mid2).second.first,grid_max(mid2).second.second,l);
      |                       ^~~~