제출 #322346

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3223462020-11-14 13:47:17saarang123Solar Storm (NOI20_solarstorm)C++14
7 / 100
2049 ms63596 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
signed main() {
std::ios::sync_with_stdio(0);
std::cout.tie(0);
std::cin.tie(0);
int n, s, k;
cin >> n >> s >> k;
vector<ll> a(n + 1), d(n + 1);
vector<array<ll, 2>> c(n + 1);
for(int i = 1; i < n; i++) cin >> d[i];
for(int i = 1; i <= n; i++) cin >> a[i], a[i] += a[i - 1]; //prefix sums
vector<ll> p(n + 1);
for(int i = 1; i <= n; i++) p[i] = p[i - 1] + d[i - 1];
//cout << "prefix sums: ";
//for(int i = 1; i <= n; i++) cout << p[i] << ' '; cout << '\n';
for(int i = 1; i <= n; i++) {
int id = lower_bound(p.begin(), p.end(), p[i] + k) - p.begin();
if(id > n || p[id] > p[i] + k) id--;
//cout << id << ' ';
c[i][0] += a[id] - a[i];
c[i][1] = id + 1;
id = lower_bound(p.begin(), p.end(), p[i] - k) - p.begin();
c[i][0] += a[i] - a[id];
if(id) c[i][0] += a[id] - a[id - 1];
//cout << id << ' ' << c[i][0] << '\n';
}
vector<ll> prev(n + 1), dp(n + 1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

SolarStorm.cpp: In function 'int main()':
SolarStorm.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   53 |     for(int x : shield) cout << x << ' '; cout << '\n';
      |     ^~~
SolarStorm.cpp:53:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   53 |     for(int x : shield) cout << x << ' '; cout << '\n';
      |                                           ^~~~
SolarStorm.cpp:31:19: warning: 'best.std::array<long long int, 2>::_M_elems[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     array<int, 2> best;
      |                   ^~~~
SolarStorm.cpp:31:19: warning: 'best.std::array<long long int, 2>::_M_elems[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...