제출 #103106

#제출 시각아이디문제언어결과실행 시간메모리
103106minson123커다란 상품 (IOI17_prize)C++11
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; typedef long long ll; typedef pair<int,int> pii; int pos; map<int,pii> dic; pii query(int p){ if(dic.find(p)!=dic.end()) return dic[p]; vector<int> q=ask(p); return dic[p]=pii(q[0],q[1]); } vector<int> solve(int l,int r,vector<int> tar){ if(pos!=-1) return vector<int>({0,0}); if(l==r){ vector<int> q=query(l); if(q[0]==0 && q[1]==0 && pos==-1) pos=l; return q; } int mid=(l+r)>>1; vector<int> q=query(mid+1); if(q[0]==0 && q[1]==0 && pos==-1) pos=mid+1; if(pos!=-1) return vector<int>({0,0}); if(q[0]!=tar[0] || q[1]!=tar[1]) tar=solve(mid+1,r,tar); if(pos!=-1) return vector<int>({0,0}); return solve(l,mid,tar); } int find_best(int n){ pos=-1; vector<int> q=query(n-1); if(q[0]==0 && q[1]==0) return n-1; solve(0,n-1,q); return pos; }

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

prize.cpp: In function 'std::vector<int> solve(int, int, std::vector<int>)':
prize.cpp:16:22: error: conversion from 'pii {aka std::pair<int, int>}' to non-scalar type 'std::vector<int>' requested
   vector<int> q=query(l);
                 ~~~~~^~~
prize.cpp:21:21: error: conversion from 'pii {aka std::pair<int, int>}' to non-scalar type 'std::vector<int>' requested
  vector<int> q=query(mid+1);
                ~~~~~^~~~~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:30:21: error: conversion from 'pii {aka std::pair<int, int>}' to non-scalar type 'std::vector<int>' requested
  vector<int> q=query(n-1);
                ~~~~~^~~~~