Submission #903793

# Submission time Handle Problem Language Result Execution time Memory
903793 2024-01-11T11:22:58 Z AdamGS Roller Coaster Railroad (IOI16_railroad) C++17
0 / 100
69 ms 17084 KB
#include "railroad.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const ll INF=1e18+7;
ll plan_roller_coaster(vector<int>S, vector<int>T) {
  int n=S.size();
  vector<pair<ll,ll>>V;
  rep(i, n) {
    V.pb({S[i], 1});
    V.pb({T[i], -1});
  }
  sort(all(V));
  ll lst=V[0].st, sum=-1, ans=0;
  for(auto i : V) {
    ans+=(i.st-lst)*max(i.nd, 0ll);
    lst=i.st;
  }
  return ans;
}

Compilation message

railroad.cpp: In function 'll plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:20:19: warning: unused variable 'sum' [-Wunused-variable]
   20 |   ll lst=V[0].st, sum=-1, ans=0;
      |                   ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB answer is not correct: 155862187 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB answer is not correct: 155862187 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 17084 KB answer is not correct: 1 instead of 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB answer is not correct: 155862187 instead of 0
2 Halted 0 ms 0 KB -