# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
810470 | 2023-08-06T10:01:52 Z | oscar1f | 코알라 (APIO17_koala) | C++17 | 38 ms | 580 KB |
#include<bits/stdc++.h> #include "koala.h" using namespace std; int coeff; int posVal[100]; vector<int> init(100); vector<int> jouer(vector<int> a) { /*for (int i:a) { cout<<i<<" "; } cout<<endl;*/ vector<int> b(100); playRound(a.data(),b.data()); return b; } int minValue(int N, int W) { vector<int> rep(N),quest(N); quest[0]=1; rep=jouer(quest); for (int i=1;i<N;i++) { if (rep[i]==0) { return i; } } return 0; } int maxValue(int N, int W) { vector<int> rep(N),quest(N); vector<int> listeGrand,nouv; int nbMis; for (int i=0;i<N;i++) { quest[i]=1; listeGrand.push_back(i); } vector<int> tailleTour={1,2,4,11}; reverse(tailleTour.begin(),tailleTour.end()); while (listeGrand.size()>1) { /*cout<<listeGrand.size()<<" : "; for (int i:listeGrand) { cout<<i<<" "; } cout<<endl;*/ nbMis=tailleTour.back(); tailleTour.pop_back(); nouv.clear(); quest=init; for (int i:listeGrand) { quest[i]=nbMis; } rep=jouer(quest); for (int i:listeGrand) { if (rep[i]>nbMis) { nouv.push_back(i); } } listeGrand=nouv; } return listeGrand.back(); } int greaterValue(int N, int W) { vector<int> rep(N),quest(N); int deb=1,fin=13,mid; while (1>0) { mid=(deb+fin)/2; quest[0]=mid; quest[1]=mid; rep=jouer(quest); if (rep[0]>mid and rep[1]<=mid) { return 0; } if (rep[1]>mid and rep[0]<=mid) { return 1; } if (rep[0]>mid) { deb=mid+1; } else { fin=mid-1; } } return 42; } void solve(int deb,int fin,vector<int> pos) { /*cout<<deb<<" "<<fin<<" : "; for (int i:pos) { cout<<i<<" "; } cout<<endl;*/ if (deb>fin) { return ; } if (deb==fin) { posVal[pos[0]]=deb; return; } vector<int> petit,grand,quest,rep; for (int i=coeff;i<=13*coeff;i+=coeff) { petit.clear(); grand.clear(); quest=init; for (int j:pos) { quest[j]=i; } rep=jouer(quest); for (int j:pos) { if (rep[j]>i) { grand.push_back(j); } else { petit.push_back(j); } } //cout<<petit.size()<<" "<<grand.size()<<endl; if (!grand.empty() and !petit.empty()) { solve(deb,deb+petit.size()-1,petit); solve(deb+petit.size(),fin,grand); return; } } } void allValues(int N, int W, int *P) { vector<int> deb; if (W==100) { coeff=1; } else { coeff=2; } for (int i=0;i<N;i++) { deb.push_back(i); } solve(1,N,deb); /*for (int i:posVal) { cout<<i<<" "; }*/ for (int i=0;i<N;i++) { P[i]=posVal[i]; } }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 316 KB | Output is correct |
2 | Correct | 3 ms | 208 KB | Output is correct |
3 | Correct | 3 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 208 KB | Output is correct |
2 | Correct | 10 ms | 324 KB | Output is correct |
3 | Correct | 10 ms | 316 KB | Output is correct |
4 | Correct | 12 ms | 316 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 336 KB | Output is correct |
2 | Correct | 38 ms | 336 KB | Output is correct |
3 | Correct | 33 ms | 336 KB | Output is correct |
4 | Correct | 34 ms | 336 KB | Output is correct |
5 | Correct | 34 ms | 336 KB | Output is correct |
6 | Correct | 34 ms | 328 KB | Output is correct |
7 | Correct | 33 ms | 324 KB | Output is correct |
8 | Correct | 34 ms | 332 KB | Output is correct |
9 | Correct | 36 ms | 340 KB | Output is correct |
10 | Correct | 35 ms | 320 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 9 ms | 336 KB | Output is partially correct |
2 | Partially correct | 8 ms | 336 KB | Output is partially correct |
3 | Partially correct | 8 ms | 336 KB | Output is partially correct |
4 | Partially correct | 8 ms | 336 KB | Output is partially correct |
5 | Partially correct | 8 ms | 336 KB | Output is partially correct |
6 | Partially correct | 8 ms | 336 KB | Output is partially correct |
7 | Partially correct | 8 ms | 336 KB | Output is partially correct |
8 | Partially correct | 8 ms | 336 KB | Output is partially correct |
9 | Partially correct | 8 ms | 336 KB | Output is partially correct |
10 | Partially correct | 8 ms | 580 KB | Output is partially correct |
11 | Partially correct | 8 ms | 332 KB | Output is partially correct |
12 | Partially correct | 8 ms | 336 KB | Output is partially correct |
13 | Partially correct | 8 ms | 336 KB | Output is partially correct |
14 | Partially correct | 8 ms | 336 KB | Output is partially correct |
15 | Partially correct | 8 ms | 332 KB | Output is partially correct |
16 | Partially correct | 8 ms | 336 KB | Output is partially correct |
17 | Partially correct | 8 ms | 336 KB | Output is partially correct |
18 | Partially correct | 8 ms | 336 KB | Output is partially correct |
19 | Partially correct | 8 ms | 332 KB | Output is partially correct |
20 | Partially correct | 8 ms | 332 KB | Output is partially correct |
21 | Partially correct | 8 ms | 336 KB | Output is partially correct |
22 | Partially correct | 8 ms | 324 KB | Output is partially correct |
23 | Partially correct | 8 ms | 336 KB | Output is partially correct |
24 | Partially correct | 9 ms | 328 KB | Output is partially correct |
25 | Partially correct | 8 ms | 324 KB | Output is partially correct |
26 | Partially correct | 8 ms | 336 KB | Output is partially correct |
27 | Partially correct | 8 ms | 336 KB | Output is partially correct |
28 | Partially correct | 9 ms | 336 KB | Output is partially correct |
29 | Partially correct | 8 ms | 320 KB | Output is partially correct |
30 | Partially correct | 8 ms | 336 KB | Output is partially correct |
31 | Partially correct | 8 ms | 336 KB | Output is partially correct |
32 | Partially correct | 9 ms | 336 KB | Output is partially correct |
33 | Partially correct | 8 ms | 336 KB | Output is partially correct |
34 | Partially correct | 8 ms | 328 KB | Output is partially correct |
35 | Partially correct | 8 ms | 336 KB | Output is partially correct |
36 | Partially correct | 8 ms | 336 KB | Output is partially correct |
37 | Partially correct | 9 ms | 336 KB | Output is partially correct |
38 | Partially correct | 8 ms | 332 KB | Output is partially correct |
39 | Partially correct | 8 ms | 336 KB | Output is partially correct |
40 | Partially correct | 8 ms | 328 KB | Output is partially correct |