| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 940917 | LittleOrange | Collecting Stamps 3 (JOI20_ho_t3) | C++17 | 3581 ms | 1048576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll big = 1e18;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
ll n,l;
cin >> n >> l;
vector<ll> x(n),t(n);
for(ll &i : x) cin >> i;
for(ll &i : t) cin >> i;
vector<vector<ll>> dp(1<<n,vector<ll>(n,big));
for(ll i = 0;i<n;i++){
ll d = min(x[i],l-x[i]);
if(d<=t[i]){
dp[1<<i][i] = d;
}
}
ll ans = 0;
for(ll i = 1;i<(1<<n);i++){
for(ll j = 0;j<n;j++) if(i>>j&1){
for(ll k = 0;k<n;k++) if(i>>k&1^1){
ll dd = abs(x[j]-x[k]);
ll d = dp[i][j]+min(dd,l-dd);
if (d<=t[k]){
dp[i|(1<<k)][k] = min(dp[i|(1<<k)][k],d);
}
}
if(dp[i][j]<big) ans = max(ans,(ll)__builtin_popcountll(i));
}
}
cout << ans << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
