제출 #1231262

#제출 시각아이디문제언어결과실행 시간메모리
1231262bangan나일강 (IOI24_nile)C++20
0 / 100
23 ms4284 KiB
#include "nile.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ALL(a) a.begin(), a.end() std::vector<long long> calculate_costs(std::vector<int> W, std::vector<int> A, std::vector<int> B, std::vector<int> E) { int N = W.size(); int Q = E.size(); vector<int> ord(N); iota(ALL(ord), 0); sort(ALL(ord), [&](int i, int j) { return W[i]<W[j]; }); vector<ll> ret; for (int D : E) { for (int i=0; i<N;) { int j = i+1; while (j<N && W[ord[j]] - W[ord[j-1]] <= D) j++; int sz = j-i; if (sz%2 == 0) ret.pb(sz); else ret.pb(sz+1); i=j; } } return ret; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...