답안 #283358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283358 2020-08-25T15:05:49 Z kevlee Languages (IOI10_languages) C++17
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include "lang.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 7897897897897897
#define base 70001
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
set <ll> s[56];
int zero;
int maxfreq, space, f[100000], cnt[56];
void excerpt(int *a) {
  FOR(i, 0, 99) {
    f[a[i]]++;
    if (f[a[i]] > maxfreq) {
      maxfreq = f[a[i]];
      space = a[i];
    }
  }
  SET(cnt, 0);
  ll hash = 0;
  int len = 0;
  vl v;
  FOR(i, 0, 99) {
    if (a[i] != space) {
      hash = (hash * base) % mod;
      hash = (hash + a[i]) % mod;
      len++;
      FOR(j, 0, 55) {
        if (s[j].count(a[i])) cnt[j]++;
      }
      if (len == 2) {
        FOR(j, 0, 55) {
          if (s[j].count(hash) cnt[j] += 2;
        }
      }
      if (len == 3) {
        FOR(j, 0, 55) {
          if (s[j].count(hash) cnt[j] += 3;
        }
      }
    } else {
      if (hash == 0 || len <= 3) continue;
      FOR(j, 0, 55) {
        if (s[j].count(hash)) cnt[j] += 4;
      }
      v.pb(hash);
      len = 0;
      hash = 0;
    }
  }
  if (hash && len <= 3) {
    FOR(j, 0, 55) {
      if (s[j].count(hash)) cnt[j] += 4;
    }
    v.pb(hash);
  }
  int maxx = 0, lang = 0;
  FOR(i, 0, 55) {
    if (cnt[i] > maxx) {
      maxx = cnt[i];
      lang = i;
    }
  }
  int ans = language(lang);
  for (auto it: v) {
    s[ans].insert(it);
  }
  FOR(i, 0, 99) s[ans].insert(a[i]);
}

Compilation message

lang.cpp: In function 'void excerpt(int*)':
lang.cpp:48:31: error: expected ';' before 'cnt'
   48 |           if (s[j].count(hash) cnt[j] += 2;
      |                               ^~~~
      |                               ;
lang.cpp:49:9: error: expected primary-expression before '}' token
   49 |         }
      |         ^
lang.cpp:48:44: error: expected ')' before '}' token
   48 |           if (s[j].count(hash) cnt[j] += 2;
      |              ~                             ^
      |                                            )
   49 |         }
      |         ~                                   
lang.cpp:49:9: error: expected primary-expression before '}' token
   49 |         }
      |         ^
lang.cpp:53:31: error: expected ';' before 'cnt'
   53 |           if (s[j].count(hash) cnt[j] += 3;
      |                               ^~~~
      |                               ;
lang.cpp:54:9: error: expected primary-expression before '}' token
   54 |         }
      |         ^
lang.cpp:53:44: error: expected ')' before '}' token
   53 |           if (s[j].count(hash) cnt[j] += 3;
      |              ~                             ^
      |                                            )
   54 |         }
      |         ~                                   
lang.cpp:54:9: error: expected primary-expression before '}' token
   54 |         }
      |         ^