제출 #1272482

#제출 시각아이디문제언어결과실행 시간메모리
1272482kl0989eAliens (IOI16_aliens)C++20
25 / 100
2086 ms6976 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pb push_back #define vi vector<int> #define vl vector<ll> #define pi pair<int, int> #define pl pair<ll,ll> #define all(x) (x).begin(),(x).end() long long take_photos(int n, int m, int k, vi r, vi c) { vector<pl> po(n); vl pmx(n); for (int i=0; i<n; i++) { po[i].fi=min(r[i],c[i]); po[i].se=max(r[i],c[i]); } sort(all(po)); for (int i=0; i<n; i++) { pmx[i]=po[i].se; if (i>0) { pmx[i]=max(pmx[i],pmx[i-1]); } } vector<vl> dp(n+1,vl(k+1,1e13)); dp[0][0]=0; for (int i=1; i<=n; i++) { for (int j=1; j<=k; j++) { ll mx=po[i-1].se; for (int i2=i-1; i2>=0; i2--) { ll sub=0; mx=max(mx,po[i2].se); if (i2>0 && pmx[i2-1]>=po[i2].fi) { sub=(pmx[i2-1]-po[i2].fi+1)*(pmx[i2-1]-po[i2].fi+1); } if (i2>0 && pmx[i2-1]>=mx) { dp[i][j]=min(dp[i][j],dp[i2][j]); } else { dp[i][j]=min(dp[i][j],dp[i2][j-1]+(mx-po[i2].fi+1)*(mx-po[i2].fi+1)-sub); } } /*dp[i][j+1]=min(dp[i][j],dp[i][j+1]); ll mx=po[i].se; for (int i2=i; i2<n; i2++) { mx=max(mx,po[i2].se); ll sub=0; if (i>0 && pmx[i-1]>=po[i].fi) { sub=(pmx[i-1]-po[i].fi+1)*(pmx[i-1]-po[i].fi+1); } if (i>0 && pmx[i-1]>=mx) { continue; } dp[i2+1][j+1]=min(dp[i2+1][j+1],dp[i][j]+(mx-po[i].fi+1)*(mx-po[i].fi+1)-sub); }*/ } } return *min_element(all(dp[n])); }

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

aliens.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
aliens_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...