Submission #1046739

#TimeUsernameProblemLanguageResultExecution timeMemory
1046739mariaclara버섯 세기 (IOI20_mushrooms)C++17
45.47 / 100
8 ms600 KiB
#include "mushrooms.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define mk make_pair #define pb push_back #define fr first #define sc second int C = 50; int count_mushrooms(int n) { vector<int> A, B; A.pb(0); for(int i = 1; i < n; i++) { if(use_machine({0,i}) == 0) A.pb(i); else B.pb(i); if(sz(A) >= C or sz(B) >= C) break; } int use = 0; if(sz(A) < sz(B)) use = 1; int ans = sz(A); for(int i = sz(A) + sz(B); i < n; i+=C) { if(use == 0) { vector<int> q; for(int j = i; j < min(n,i+C); j++) q.pb(A[j-i]), q.pb(j); int x = use_machine(q); x = sz(q) - 1 - x; // número de posições que são iguais ans += (x+1)/2; } else { vector<int> q; for(int j = i; j < min(n,i+C); j++) q.pb(B[j-i]), q.pb(j); int x = use_machine(q); // número de posições que são diferentes ans += (x+1)/2; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...