제출 #1310866

#제출 시각아이디문제언어결과실행 시간메모리
1310866iamsazidhPyramids (IOI24_pyramids)C++20
100 / 100
42 ms5076 KiB
//ᴇᴀᴄʜ ᴘᴇʀꜱᴏɴ ᴡɪʟʟ ᴏɴʟʏ ʜᴀᴠᴇ ᴡʜᴀᴛ ᴛʜᴇʏ ᴇɴᴅᴇᴀᴠᴏᴜʀᴇᴅ ᴛᴏᴡᴀʀᴅꜱ [53:39]
//Author: Sazid Hasan
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef double                 dl;
typedef vector<int>            vi;
typedef vector<vector<int>>    vii;
typedef vector<ll>             vl;
typedef vector<bool>           vb;
typedef pair<int,int>         pii;
typedef pair<ll, ll>          pll;

#define ff                first
#define ss                second
#define all(a)            a.begin(),a.end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          (a*(b/gcd(a,b)))
#define spc               " "

#ifdef ONLINE_JUDGE
    #define debarr(array)
    #define deb(x)
    #define del
#else
    #define debarr(array)  for(int w = 0; w < array.size(); w++) cerr << #array << "-" << w << " = " << array[w] << endl;
    #define deb(x)         cerr << #x << " = " << x << endl;
    #define del cerr << '\n';
#endif


const double PI =         acos(-1);
const int MOD =           1000000007;
const int inf =           (2147483647);
#include "pyramids.h"

vl a, b;

void init(std::vector<int> A, std::vector<int> B) {
  int n = A.size();
  a.resize(n, 0);
  b.resize(n, 0);
  a[0] = A[0];
  b[0] = B[0];
  for(int i = 1; i < n; i++){
    a[i] = a[i-1]+A[i];
    b[i] = b[i-1]+B[i];
  }
}

bool can_transform(int L, int R, int X, int Y) {
  return (a[R] - (L>0 ? a[L-1] : 0)) == (b[Y] - (X>0 ? b[X-1] : 0));
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...