Submission #942144

# Submission time Handle Problem Language Result Execution time Memory
942144 2024-03-10T10:01:23 Z Nika533 Shortcut (IOI16_shortcut) C++14
0 / 100
1 ms 348 KB
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "shortcut.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,T,k;
long long find_shortcut(int n, vector<int> L, vector<int> D, int C) {
	long long ans=1e18;
	int pref[n+1]; pref[0]=0;
	for (int i=1; i<n; i++) pref[i]=pref[i-1]+L[i-1];
	for (int l=0; l<n; l++) {
		for (int r=l+1; r<n; r++) {
			int LEN=0;
			for (int o=l; o<r; o++) LEN+=L[o];
			vector<long long> dd;
			for (auto x:D) dd.pb(x);
			long long sum1=0,sum2=0;
			for (int i=0; i<l; i++) sum1+=D[i];
			for (int i=r+1; i<n; i++) sum2+=D[i];
			dd[l]=max(dd[l],sum1);
			dd[r]=max(dd[r],sum2);
			long long diameter=0;
			for (int i=l; i<=r; i++) {
				for (int j=i+1; j<=r; j++) {
					long long len=pref[j]-pref[i];
					len=min(len,LEN-len+C);
					len+=dd[i]+dd[j];
					diameter=max(diameter,len);
				}
			}
			for (int i=0; i<=l; i++) {
				for (int j=i+1; j<=l; j++) {
					long long len=pref[j]-pref[i];
					len+=D[i]+D[j];
					diameter=max(diameter,len);
				}
			}
			for (int i=r; i<n; i++) {
				for (int j=i+1; j<n; j++) {
					long long len=pref[j]-pref[i];
					len+=D[i]+D[j];
					diameter=max(diameter,len);
				}
			}
			ans=min(ans,diameter);
		}
	}
	return ans;
}

Compilation message

shortcut.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 348 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -