Submission #839039

#TimeUsernameProblemLanguageResultExecution timeMemory
839039CookieRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "robots.h" using namespace std; ifstream fin("susss.txt"); ofstream fout("res.txt"); #define forr(i, a, b) for(int i = a; i < b; i++) #define pb push_back #define vt vector #define fi first #define se second #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define sz(v) (int)v.size() const int mxn = 1e6, inf = 1e9, mod = 1e9 + 7, mxm = 50005; int t, a, b; pii p[mxn + 1]; int x[mxm + 1], y[mxm + 1], cnt[mxm + 1]; bool good[mxn + 1]; bool ck(int mid){ set<pair<int, int>>s; for(int i = 1; i <= b; i++){ cnt[i] = mid; s.insert(make_pair(y[i], i)); } for(int i = t; i >= 1; i--){ good[i] = 0; auto it = s.lower_bound(make_pair(p[i].se + 1, -1)); if(it != s.end()){ good[i] = 1; int id = (*it).second; cnt[id]--; if(cnt[id] == 0){ s.erase(make_pair(y[id], id)); } } } int bestid = a, cntt = mid; for(int i = t; i >= 1; i--){ if(!good[i]){ if(p[i].fi >= x[bestid])return(0); cntt--; if(cntt == 0){ bestid--; cntt = mid; } } } return(1); } int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]); a = A; b = B; t = T; for(int i = 1; i <= a; i++)x[i] = X[i]; for(int i = 1; i <= b; i++)y[i] = Y[i]; sort(x + 1, x + a + 1); sort(y + 1, y + b + 1); for(int i = 1; i <= t; i++){ p[i].fi = W[i]; p[i].se = S[i]; } sort(p + 1, p + t + 1); int l = 1, r = t, ans = -1; while(l <= r){ int mid = (l + r) >> 1; if(ck(mid)){ ans = mid; r = mid - 1; }else{ l = mid + 1; } } return(ans); }

Compilation message (stderr)

robots.cpp:50:64: warning: `\U0000037e' is not in NFC [-Wnormalized=]
   50 | int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]);
      |                                                                ^
robots.cpp:50:64: error: expected initializer before '\U0000037e'
   50 | int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]);
      |                                                                ^
robots.cpp:51:12: error: 'b' does not name a type
   51 |     a = A; b = B; t = T;
      |            ^
robots.cpp:51:19: error: 't' does not name a type
   51 |     a = A; b = B; t = T;
      |                   ^
robots.cpp:52:5: error: expected unqualified-id before 'for'
   52 |     for(int i = 1; i <= a; i++)x[i] = X[i];
      |     ^~~
robots.cpp:52:20: error: 'i' does not name a type
   52 |     for(int i = 1; i <= a; i++)x[i] = X[i];
      |                    ^
robots.cpp:52:28: error: 'i' does not name a type
   52 |     for(int i = 1; i <= a; i++)x[i] = X[i];
      |                            ^
robots.cpp:53:5: error: expected unqualified-id before 'for'
   53 |     for(int i = 1; i <= b; i++)y[i] = Y[i];
      |     ^~~
robots.cpp:53:20: error: 'i' does not name a type
   53 |     for(int i = 1; i <= b; i++)y[i] = Y[i];
      |                    ^
robots.cpp:53:28: error: 'i' does not name a type
   53 |     for(int i = 1; i <= b; i++)y[i] = Y[i];
      |                            ^
robots.cpp:54:9: error: expected constructor, destructor, or type conversion before '(' token
   54 |     sort(x + 1, x + a + 1); sort(y + 1, y + b + 1);
      |         ^
robots.cpp:54:33: error: expected constructor, destructor, or type conversion before '(' token
   54 |     sort(x + 1, x + a + 1); sort(y + 1, y + b + 1);
      |                                 ^
robots.cpp:55:5: error: expected unqualified-id before 'for'
   55 |     for(int i = 1; i <= t; i++){
      |     ^~~
robots.cpp:55:20: error: 'i' does not name a type
   55 |     for(int i = 1; i <= t; i++){
      |                    ^
robots.cpp:55:28: error: 'i' does not name a type
   55 |     for(int i = 1; i <= t; i++){
      |                            ^
robots.cpp:58:9: error: expected constructor, destructor, or type conversion before '(' token
   58 |     sort(p + 1, p + t + 1);
      |         ^
robots.cpp:60:5: error: expected unqualified-id before 'while'
   60 |     while(l <= r){
      |     ^~~~~
robots.cpp:68:5: error: expected unqualified-id before 'return'
   68 |     return(ans);
      |     ^~~~~~
robots.cpp:69:1: error: expected declaration before '}' token
   69 | }
      | ^