제출 #889743

#제출 시각아이디문제언어결과실행 시간메모리
889743UmairAhmadMirzaAliens (IOI16_aliens)C++14
0 / 100
1 ms600 KiB
#pragma once #include <bits/stdc++.h> using namespace std; int const N=505; long long const inf=1e9; long long dp[N][N]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c){ for (int i = 1; i <=n; ++i) for(int j = 0; j <=k; ++j) dp[i][j]=inf; vector<long long> v; v.push_back(r[0]); for (int i = 1; i < n; ++i) if(r[i]!=r[i-1]) v.push_back(r[i]); n=v.size(); dp[0][0]=0; k=min(n,k); for (int i = 1; i <=n; ++i){ for(int j = 1; j <=k; ++j){ dp[i][j]=dp[i][j-1]; for (int ii = 0; ii < i; ++ii){ long long sm=(abs(v[i-1]-v[ii])+1); sm*=sm; dp[i][j]=min(dp[i][j],dp[ii][j-1]+sm); } } } return dp[n][k]; }

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

aliens.cpp: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...