Submission #588223

#TimeUsernameProblemLanguageResultExecution timeMemory
588223CaroLindaLanguages (IOI10_languages)C++14
0 / 100
10011 ms2144 KiB
#include <bits/stdc++.h> #include "grader.h" #include "lang.h" #define ll long long const int MAX = 1e4+10; const int MAX_SYMBOLS = 65545; const int MAX_LANGUAGES = 60; const long long PRIME = 37; const long long MOD = 1e9+7; const int MAGIC = -1; using namespace std; int vezes = 0; int spaceChar = -1; int freq[MAX_SYMBOLS]; vector< vector<int> > lang; map<long long, int> mp[MAX]; vector<int> ans; map<long long, int> curMp; int foi[MAX_LANGUAGES]; int get(){ return max_element(freq, freq+MAX_SYMBOLS)-freq; } void putToMap(map<ll,int> &m, vector<int> &v){ long long cur = 0; m.clear(); for(auto &e : v){ if(e == spaceChar){ m[cur]++; cur = 0; } else cur = ( (cur * PRIME) + e+1 ) % MOD; } m[cur]++; } int comp(int x){ int ret = 0; for(auto &e : mp[x]) ret += min(e.second, curMp[e.first]); return ret; } void excerpt(int *E) { srand(time(0)); vector<int> thisVector; for(int i = 0; i < 100; i++){ thisVector.push_back(E[i]); freq[E[i]]++; } spaceChar = get(); vezes++; if(vezes == MAGIC){ vezes = 0; for(int i = 0; i < lang.size(); i++) putToMap(mp[i], lang[i]); } putToMap(curMp, thisVector); int tenta = 1; if(!lang.empty()){ vector<pair<int,int> > v; int aux = 0; int cmpWinner = comp(0); for(int i = 1; i < ans.size(); i++){ int s = comp(i); if(s > cmpWinner){ cmpWinner = s; aux = i; } } tenta = ans[aux]; } int ret = language(tenta); if( (++foi[ret]) > 7 ) return; putToMap(mp[lang.size()], thisVector); lang.push_back(thisVector) ; ans.push_back(ret); }

Compilation message (stderr)

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:71:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |       for(int i = 0; i < lang.size(); i++)
      |                      ~~^~~~~~~~~~~~~
lang.cpp:85:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |       for(int i = 1; i < ans.size(); i++){
      |                      ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...