#include "testlib.h" #include #include #include #include using namespace std; int n = 0, a[100010]; int check(int w){ int L = 1, S = 0; for(int i = 1; i <= n; i++){ if(a[i] > w)return 0; if(S+a[i] <= w)S += a[i]; else S = a[i], L++; } return L; } int main(int argc, char *argv[]) { /* * inf: input * ouf: player output * ans: standard output */ registerInteraction(argc, argv); int t = 1; cout.flush(); cout<= 50000){ cout<<0<= L){ ansr = mid; l = mid+1; } else r = mid; } l = ansl, r = ansr; } } else{ quitf(_wa, "Invalid operation"); } int chosen = l+inf.readInt()%(r-l+1); op = ouf.readWord(); if(op == "!"){ int w = ouf.readInt(); if(l == r && l == w){ double score = (200000.0-1.0*sumn)/(200000.0-23867.0); score = min(score, 1.0); score = max(score, 0.0); quitp(score, "Ratio: %.3lf", score); } else quitf(_wa, "Wrong guess"); } else if(op == "?"){ n = ouf.readInt(1, 100000); sumn += n; for(int i = 1; i <= n; i++){ a[i] = ouf.readInt(1, 100000); } cout<