Submission #450412

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4504122021-08-02 19:51:03snoopToll (BOI17_toll)C++14
100 / 100
206 ms22792 KiB
#include<bits/stdc++.h>
#include<math.h>
#define f first
#define s second
#define int long long
using namespace std;
const int N = 5e4 + 5, oo = 1e18;
int t, dist[N][5][5], d[N][5][5], n, k, m, q, ans[N];
vector<int> cur[N];
pair<int, int> p[N];
void solve(int l, int r, vector<int> v) {
if (l == r) return;
int mid = (l + r) / 2;
vector<int> x, y;
for (int i = l; i <= r; i++) cur[i].clear();
for (int i = 0; i < v.size(); i++) {
int ind = v[i];
if (p[ind].s / k <= mid) x.push_back(v[i]);
else if (p[ind].f / k >= mid + 1) y.push_back(v[i]);
else cur[p[ind].s / k].push_back(v[i]);
}
for (int j = 0; j < k; j++) {
for (int x = 0; x < k; x++) {
d[mid + 1][j][x] = 0;
}
}
for (int i = mid; i >= l; i--) {
for (int from = 0; from < k; from++) {
for (int to = 0; to < k; to++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

toll.cpp: In function 'void solve(long long int, long long int, std::vector<long long int>)':
toll.cpp:16:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i = 0; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
toll.cpp:53:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   for (int j = 0; j < cur[i].size(); j++) {
      |                   ~~^~~~~~~~~~~~~~~
#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...