제출 #555583

#제출 시각아이디문제언어결과실행 시간메모리
555583KhizriAliens (IOI16_aliens)C++17
16 / 100
101 ms2268 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define INF 1e18 #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define pii pair<int,int> #define pll pair<ll,ll> #define OK cout<<"Ok"<<endl; #define MOD (ll)(1e9+7) #define endl "\n" //------------------- const int mxn=500+5; ll dp[mxn][mxn],arr[mxn],x[mxn],y[mxn],color[mxn][mxn]; ll solve(int n,int m){ for(int ind=1;ind<=n;ind++){ for(int i=min(x[ind],y[ind]);i<=max(x[ind],y[ind]);i++){ for(int j=min(x[ind],y[ind]);j<=max(x[ind],y[ind]);j++){ color[i][j]=1; } } } int ans=0; for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ if(color[i][j]){ ans++; } } } return ans; } long long take_photos(int n, int m, int k, vector<int> vt,vector<int> c) { for(int i=0;i<vt.size();i++){ arr[i+1]=vt[i]; x[i+1]=vt[i]; y[i+1]=c[i]; } if(n<=50&&m<=100&&k==n){ return solve(n,m); } sort(arr+1,arr+n+1); for(int i=1;i<=n;i++){ dp[1][i]=(arr[i]-arr[1]+1)*(arr[i]-arr[1]+1); } for(int i=2;i<=k;i++){ for(int j=1;j<=n;j++){ dp[i][j]=dp[i-1][j]; for(int k=1;k<=j;k++){ dp[i][j]=min(dp[i][j],dp[i-1][k-1]+(arr[j]-arr[k]+1)*(arr[j]-arr[k]+1)); } } } return dp[k][n]; }

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

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int i=0;i<vt.size();i++){
      |                 ~^~~~~~~~~~
#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...