Submission #773795

#TimeUsernameProblemLanguageResultExecution timeMemory
773795lollipopLanguages (IOI10_languages)C++17
0 / 100
54 ms39932 KiB
#include "grader.h" #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> //#define int 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 N = 2e5 + 10 ; mt19937 R(time(0)); map < int , int > ma , ma1 ; int sm[ 56 ][ 123990 ] ; int PP = 123989 ; int hsh[ 66000 ] ; void excerpt( int E[ 100 ] ){ pair < int , int > p = { 0 , 0 } ; int pip = 55 , pp = 1 ; if( hsh[ 0 ] == 0 ){ hsh[ 0 ] = 1 ; for( int j = 1 ; j <= 65535 ; j ++ ){ hsh[ j ] = j * pp % PP ; pp = pp * pip % PP ; } } FOR( i, 56 ){ int cur = 0 ; FOR( j , 97 ) { int cur1 = hsh[ E[ j ] ] + pip * hsh[ E[ j + 1 ] ] % PP ; cur1 = cur1 + hsh[ E[ j + 2 ] ] * pip * pip ; cur1 %= PP ; cur1 = cur1 + (hsh[ E[ j + 3 ] ] * pip * pip % PP )* pip ; cur1 %= PP ; if( sm[ i ][ cur1 ] == 1 ) cur ++ ; } if( p.f < cur ) p = { cur , i } ; } int x = language( p.s ) ; FOR( j , 97 ){ int cur = hsh[ E[ j ] ] + pip * hsh[ E[ j + 1 ] ] % PP ; cur = cur + hsh[ E[ j + 2 ] ] * pip * pip % PP ; cur %= PP ; cur = cur + ( hsh[ E[ j + 3 ] ] * pip * pip % PP )* pip ; cur %= PP ; sm[ x ][ cur ] = 1 ; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...