Submission #288933

#TimeUsernameProblemLanguageResultExecution timeMemory
288933TangentAliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include "aliens.h"
#include <bits/stdc++.h>

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(), order_of_key()

typedef long long ll;
typedef long double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<dd, dd> pdd;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<dd> vdd;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vdd> vvdd;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
typedef vector<vpdd> vvpdd;
typedef vector<bool> vb;

const int inf = 1 << 30;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define ffor(i, a, b) for(ll i = a; i < b; i++)
#define forin(x, a) for (auto &x: a)
#define all(x) x.begin(), x.end()

#ifdef TEST
#define dbg(x) cout << #x << ": " << x << '\n';
#define dbgc(x) cout << #x << ":"; forin(a, x) { cout << " " << a; } cout << endl;
#define tassert(x) assert(x);
#else
#define dbg(x)
#define dbgc(x)
#define tassert(x)
#endif

bool cmp(pii &a, pii &b) {
  if (a.first == b.first) {
    return b.second < a.second;
  }
  return a.first < b.first;
}

long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
  vpii segs;
  rep(i, k) {
    segs.emplace_back(minmax(r[i], c[i]));
  }
  sort(all(segs));

  ll res = 0;
  pii last = {-1, -1};
  int l;
  forin(seg, segs) {
    res += (seg.second - seg.first + 1) * (seg.second - seg.first + 1);
    l = min(last.second, seg.second) - seg.first + 1
    if (l > 0) {
      res -= l * l;
    }
    last = seg;
  }

  return res;
}

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:67:53: error: expected ';' before 'if'
   67 |     l = min(last.second, seg.second) - seg.first + 1
      |                                                     ^
      |                                                     ;
   68 |     if (l > 0) {
      |     ~~