Submission #57760

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
577602018-07-16 02:48:01spencercomptonSparklers (JOI17_sparklers)C++17
100 / 100
212 ms31820 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, k;
ll t;
bool v[1001][1001];
ll pos[1001];
// ll dp[2][1000][1000];
// ll pos[1000];
vector<ll> all;
int main(){
ll tt;
cin >> n >> k >> tt;
for(int i = 0; i<n; i++){
cin >> pos[i];
}
k--;
ll low = 0LL;
ll high = 1000000000LL;
while(low<high){
ll mid = (low+high)/2LL;
t = mid*tt;
vector<ll> ar[2];
for(int i = 0; i<2; i++){
ar[i].push_back(0);
}
for(int i = k+1; i<n; i++){
ar[0].push_back(ar[0][ar[0].size()-1] + 2LL * t - (pos[i]-pos[i-1]));
}
for(int i = k-1; i>=0; i--){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sparklers.cpp: In function 'int main()':
sparklers.cpp:48:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j = 1; j<ar[i].size(); j++){
                   ~^~~~~~~~~~~~~
sparklers.cpp:81:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(p1+1<f[0].size() || p2+1<f[1].size()){
         ~~~~^~~~~~~~~~~~
sparklers.cpp:81:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(p1+1<f[0].size() || p2+1<f[1].size()){
                             ~~~~^~~~~~~~~~~~
sparklers.cpp:82:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(p1+1<f[0].size() && ar[1][f[1][p2].first] + f[0][p1].second >=0LL){
       ~~~~^~~~~~~~~~~~
sparklers.cpp:85:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    else if(p2+1<f[1].size() && ar[0][f[0][p1].first] + f[1][p2].second >= 0LL){
            ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...