Submission #1076278

#TimeUsernameProblemLanguageResultExecution timeMemory
1076278hasan2006Aliens (IOI16_aliens)C++17
0 / 100
1 ms348 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 5e3 + 9 , mod = 1e9 + 7; ll a[N] , b[N] , dp[N][N] , c[N] , d[N] ; long long take_photos(int n, int m, int k, std::vector<int> a, std::vector<int> b) { ll i , j , l , s = 0 , f , x , y ; set<int>st; vector<int>v; for(i = 0; i < n; i++) st.insert(a[i]); v.pb(0); for(auto to : st) v.pb(to); for(i = 0; i <= n; i++) for(j = 0; j <= n; j++) dp[i][j] = 1e9; dp[0][0] = 0; for(i = 1; i <= n; i++) { for(j = 1; j <= i; j++) { dp[i][j] = min(dp[i][j] , dp[i][j - 1]); for(x = 1; x <= i; x++) dp[i][j] = min(dp[i][j] , dp[x - 1][j - 1] + (v[i] - v[x] + 1) * (v[i] - v[x] + 1)); } } return dp[n][k]; }

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:26:16: warning: unused variable 'l' [-Wunused-variable]
   26 |     ll i , j , l , s  = 0 , f , x , y ;
      |                ^
aliens.cpp:26:20: warning: unused variable 's' [-Wunused-variable]
   26 |     ll i , j , l , s  = 0 , f , x , y ;
      |                    ^
aliens.cpp:26:29: warning: unused variable 'f' [-Wunused-variable]
   26 |     ll i , j , l , s  = 0 , f , x , y ;
      |                             ^
aliens.cpp:26:37: warning: unused variable 'y' [-Wunused-variable]
   26 |     ll i , j , l , s  = 0 , f , x , y ;
      |                                     ^
#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...