Submission #291911

# Submission time Handle Problem Language Result Execution time Memory
291911 2020-09-06T01:56:51 Z tatyam Languages (IOI10_languages) C++17
92 / 100
1557 ms 145896 KB
#include <bits/stdc++.h>
using namespace std;

#include "grader.h"
#include "lang.h"

#define SZ 100
using u64 = uint64_t;

int prev[1100000];
#define C(n) \
auto comp ## n = [](const array<int, n>& a){ u64 ans = 0; for(int i : a){ ans <<= 16; ans |= i; } return ans; };\
unordered_map<array<int, n>, array<int, 56>, decltype(comp ## n)> c ## n(1 << 17, comp ## n)
C(1);
C(2);
C(3);
C(4);
array<int, 56> cnt;

/*
random_device RD;
const int A = 0, B = 0, C = 1 + RD() % 4, D = RD() % 200;
struct start{
   start(){
      cout << C << ' ' << D << endl;
   }
}a;
/*/
const int A = 0, B = 0, C = 2, D = 187;
// */
void excerpt(int *E) {
   cnt.fill(0);
   for(int i = 0; i <= 100 - 1; i++){
      auto& c = c1[{E[i]}];
      for(int i = 0; i < 56; i++) cnt[i] += c[i];
   }
   for(int i = 0; i <= 100 - 2; i++){
      auto& c = c2[{E[i], E[i + 1]}];
      for(int i = 0; i < 56; i++) cnt[i] += c[i];
   }
   for(int i = 0; i <= 100 - 3; i++){
      auto& c = c3[{E[i], E[i + 1], E[i + 2]}];
      for(int i = 0; i < 56; i++) cnt[i] += c[i];
   }
   for(int i = 0; i <= 100 - 4; i++){
      auto& c = c4[{E[i], E[i + 1], E[i + 2], E[i + 3]}];
      for(int i = 0; i < 56; i++) cnt[i] += c[i];
   }

   int ans = language(max_element(cnt.begin(), cnt.end()) - cnt.begin());

   for(int i = 0; i <= 100 - 1; i++){
      auto& c = c1[{E[i]}];
      c[ans] += A;
   }
   for(int i = 0; i <= 100 - 2; i++){
      auto& c = c2[{E[i], E[i + 1]}];
      c[ans] += B;
   }
   for(int i = 0; i <= 100 - 3; i++){
      auto& c = c3[{E[i], E[i + 1], E[i + 2]}];
      c[ans] += C;
   }
   for(int i = 0; i <= 100 - 4; i++){
      auto& c = c4[{E[i], E[i + 1], E[i + 2], E[i + 3]}];
      c[ans] += D;
   }
}
# Verdict Execution time Memory Grader output
1 Correct 1523 ms 145872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1557 ms 145896 KB Output is partially correct - 84.44%