Submission #399773

#TimeUsernameProblemLanguageResultExecution timeMemory
399773Dremix10Aliens (IOI16_aliens)C++17
0 / 100
2083 ms292 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl; #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl; #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl; #else #define p(x) {} #define p2(x,y) {} #define pp(x) {} #define pv(x) {} #define ppv(x) {} #endif #define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr); const int maxp = 22; const ld EPS = 1e-18; const ll INF = 2e18; const int MOD = 1e9+7; const int N = 3e5+1; bool v[100]; int cnt; vector<pi> arr; int maxi; int m; int solve(int k){ if(sz(arr) == cnt) return 0; if(k == maxi) return MOD; int i,j,ii,jj; int best = MOD; for(i=0;i<m;i++){ /// point i,i start for(j=i;j<m;j++){ /// point j,j end int cost = (j-i+1)*(j-i+1); vector<int> used; for(ii=0;ii<sz(arr);ii++){ if(v[ii])continue; if(i<=arr[ii].F && arr[ii].F<=j && i<=arr[ii].S && arr[ii].S<=j){ v[ii] = true; used.push_back(ii); cnt++; } } best = min(best,solve(k+1) + cost); for(auto x : used){ v[x] = false; cnt--; } } } return best; } long long take_photos(int n, int mm, int k, vector<int> r, vector<int> c) { int i,j; maxi = k; m = mm; for(i=0;i<n;i++){ arr.push_back({r[i],c[i]}); } return solve(0); }

Compilation message (stderr)

aliens.cpp: In function 'int solve(int)':
aliens.cpp:45:16: warning: unused variable 'jj' [-Wunused-variable]
   45 |     int i,j,ii,jj;
      |                ^~
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:73:11: warning: unused variable 'j' [-Wunused-variable]
   73 |     int i,j;
      |           ^
#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...