Submission #802196

#TimeUsernameProblemLanguageResultExecution timeMemory
802196lollipopCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
0 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 ++ ){ if( a.size() >= -1 ){ int lf = ( n - j ) ; int jj = j ; int ss = a.size() ; int mn = min( ss , lf ) ; vector < int > v ; int nw = 0 ; FOR( i , mn ){ v.pb( a[ i ] ) ; 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 mn = min( ( int ) (b.size()) , lf ) ; vector < int > v ; FOR( i , mn ){ v.pb( b[ i ] ) ; 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 ; } } return a.size() + A.size() ; } //int use_machine(std::vector<int> x)

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:45:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |       if( a.size() >= -1 ){
      |           ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...