제출 #802213

#제출 시각아이디문제언어결과실행 시간메모리
802213lollipop버섯 세기 (IOI20_mushrooms)C++17
0 / 100
1 ms208 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define pb push_back #define s second #define f first #define pf push_front #define inf 100000000000000000 #define bitebi __builtin_popcountll #define FOR( i , n ) for( int i = 0 ; i < n ; i ++ ) #define YES cout <<"YES\n" #define NO cout << "NO\n" #define debug cout << "Here Fine" << endl ; #define pr pair < int , int > #define fbo find_by_order // returns iterator #define ook order_of_key // returns strictly less numbers than key using namespace std ; //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") using namespace __gnu_pbds; using namespace __gnu_cxx; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> const double Pi=acos(-1.0); const double EPS=1E-8; const int mod = 1000000007 ; const int mod1 = 998244353 ; const int NN = 2e5 + 10 ; //mt19937 R(time(0)); int myrandom (int i) { return std::rand()%i;} map < int , int > ma , ma1 ; #include "mushrooms.h" // int use_machine(std::vector<int> x){ // } int count_mushrooms(int n){ vector < int > a , A , b , B ; a.pb( 0 ) ; for( int j = 1 ; j < n ; j ++ ){ int sss = a.size() ; int sss1 = b.size() ; if( sss >= sss1 ){ int lf = ( n - j ) ; int jj = j ; int ss = a.size() ; int mn = min( ss , lf ) ; vector < int > v ; int nw = 0 ; FOR( kk , mn ){ v.pb( a[ kk ] ) ; v.pb( jj ) ; jj ++ ; nw ++ ; } int x = use_machine( v ) ; if( x % 2 == 1 ){ b.pb( jj - 1 ) ; } else a.pb( jj - 1 ) ; int cc = 0 ; while( x > 0 ){ cc ++ ; x-= 2 ; } cc = nw - cc ; if( x % 2 == 0 ) cc -- ; while( cc -- ) A.pb( 1 ) ; j = jj - 1 ; } else{ int lf = ( n - j ) ; int jj = j ; int sus = b.size() ; int mn = min( sus , lf ) ; vector < int > v ; FOR( kk , mn ){ v.pb( b[ kk ] ) ; v.pb( jj ) ; jj ++ ; } int x = use_machine( v ) ; if( x % 2 == 1 ){ a.pb( jj - 1 ) ; } else b.pb( jj - 1 ) ; while( x > 0 ){ A.pb( 1 ) ; x-= 2 ; } if( x % 2 == 1 ) A.pop_back(); j = jj - 1 ; } } int sis = a.size() + A.size() ; return sis ; } //int use_machine(std::vector<int> x)
#Verdict Execution timeMemoryGrader output
Fetching results...