# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1001518 | 2024-06-19T05:16:34 Z | irmuun | 버섯 세기 (IOI20_mushrooms) | C++17 | 1 ms | 344 KB |
#include<bits/stdc++.h> #include "mushrooms.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int count_mushrooms(int n){ int ans=0; vector<int>a,b; a.pb(0); for(int i=1;i<min(n,200);i++){ int d=use_machine({0,i}); if(d==0){ a.pb(i); } else{ b.pb(i); } } if(n<200){ return (int)a.size(); } ans=a.size(); if(b.size()>a.size()){ int len=b.size(); len--; for(int i=200;i<n;i+=len){ int r=min(i+len,n-1); int cur=0; vector<int>v; v.pb(b[0]); for(int j=i;j<=r;j++){ v.pb(j); v.pb(b[++cur]); } for(int j=cur+1;j<b.size();j++){ v.pb(b[j]); } ans+=use_machine(v)/2; } } else{ int len=a.size(); len--; for(int i=200;i<n;i+=len){ int r=min(i+len,n-1); int cur=0; vector<int>v; v.pb(a[0]); int cnt=0; for(int j=i;j<=r;j++){ v.pb(j); cnt++; v.pb(a[++cur]); } for(int j=cur+1;j<a.size();j++){ v.pb(a[j]); } ans+=cnt-use_machine(v)/2; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Incorrect | 1 ms | 344 KB | Duplicate value 0 in the query array. |
7 | Halted | 0 ms | 0 KB | - |