Submission #667386

# Submission time Handle Problem Language Result Execution time Memory
667386 2022-12-01T08:38:39 Z raypeng1729 Sails (IOI07_sails) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e16;
signed main(){
    ios::sync_with_stdio(false), cin.tie(0);
    int n; cin >> n;
    int a[n], b[n], mx = 0;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i], mx = max(mx, a[i]);
    int pre[mx + 2]{};
    for(int i = 0; i < n; i++){
        pre[0]++, pre[a[i] + 1]--;
    }
    for(int i = 1; i <= mx; i++) pre[i] += pre[i - 1];
    int ans = 0, cnt = accumulate(b, b + n, 0);
    ans -= cnt;
    for(int i = mx; i > 0; i--){
        int cur = min(pre[i], cnt / i);
        ans += cur * cur;
        cnt -= cur;
    }
    cout << ans / 2;
}

Compilation message

sails.cpp:10:2: error: extended character   is not valid in an identifier
   10 |     int pre[mx + 2]{};
      |  ^
sails.cpp:10:5: error: extended character   is not valid in an identifier
   10 |     int pre[mx + 2]{};
      |    ^
sails.cpp: In function 'int main()':
sails.cpp:10:2: error: '\U000000a0' was not declared in this scope
   10 |     int pre[mx + 2]{};
      |  ^
sails.cpp:12:9: error: 'pre' was not declared in this scope
   12 |         pre[0]++, pre[a[i] + 1]--;
      |         ^~~
sails.cpp:14:34: error: 'pre' was not declared in this scope
   14 |     for(int i = 1; i <= mx; i++) pre[i] += pre[i - 1];
      |                                  ^~~
sails.cpp:18:23: error: 'pre' was not declared in this scope
   18 |         int cur = min(pre[i], cnt / i);
      |                       ^~~