# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
961583 | 2024-04-12T08:34:12 Z | IUA_Hasin | 휴가 (IOI14_holiday) | C++17 | 11 ms | 1628 KB |
#include"holiday.h" #include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long using namespace std; const ll N = 100; ll vis[N]; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll sum = 0; for(int i=0; i<n; i++){ sum = sum+attraction[i]; } if(start==0){ if(d>=(2*n-1)){ return sum; } else if(d<=2){ ll ans = attraction[0]; if(d==0){ return 0; } else { return ans; } } else { ll a = min(d-1, n-1); ll b; if(d%2==0){ b = d/2; } else { b = floor(d/2)+1; } b--; for(int i=0; i<b; i++){ ll a = attraction[i]; vis[a]++; } ll ans1 = 0; for(int i=b; i<=a; i++){ ll a = attraction[i]; ll extr = d-i-1; ll ans = 0; for(int i=100; i>=0; i--){ if(vis[i]>0){ if(extr<=vis[i]){ ans = ans+i*extr; break; } else { ans = ans+i*vis[i]; extr = extr-vis[i]; } } } ans1 = max(ans1, ans); vis[a++]; } return ans1; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
5 | Runtime error | 1 ms | 1116 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 860 KB | Output is correct |
2 | Correct | 8 ms | 860 KB | Output is correct |
3 | Correct | 6 ms | 860 KB | Output is correct |
4 | Correct | 6 ms | 1016 KB | Output is correct |
5 | Incorrect | 7 ms | 860 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 860 KB | Output is correct |
3 | Correct | 1 ms | 860 KB | Output is correct |
4 | Runtime error | 1 ms | 1116 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 1628 KB | Output is correct |
2 | Correct | 8 ms | 1628 KB | Output is correct |
3 | Runtime error | 4 ms | 1628 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |