제출 #65358

#제출 시각아이디문제언어결과실행 시간메모리
65358boook로봇 (IOI13_robots)C++14
90 / 100
304 ms9244 KiB
#include "robots.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define REP(i,j,k) for(int i = j ; i < k ; ++i) #define RREP(i,j,k) for(int i = j ; i >=k ; --i) #define A first #define B second #define mp make_pair #define pb emplace_back #define PII pair<int , int> #define MEM(i,j) memset(i , j , sizeof i) #define ALL(i) i.begin() , i.end() #define DBGG(i,j) cout << i << " " << j << endl #define DB4(i,j,k,l) cout << i << " " << j << " " << k << " " << l << endl #define IOS cin.tie(0) , cout.sync_with_stdio(0) #define endl "\n" ///------------------------------------------------------------ #define int long long #define MAX 1010 #define INF 0x3f3f3f3f int sum[MAX][MAX]; int judge(int32_t now , int32_t n , int32_t w[] , int32_t a , int32_t x[]){ int pos = 0; REP(i , 0 , a){ REP(times , 0 , now){ if(pos == n) return 1; if(x[i] > w[pos]) pos ++; else break; } } return pos == n; } int32_t putaway(int32_t a, int32_t b, int32_t n, int32_t x[], int32_t y[], int32_t w[], int32_t s[]) { if(b == 0){ sort(x , x + a); sort(w , w + n); int ans = n + 1; RREP(i , 20 , 0){ int to = ans - (1 << i); if(judge(to , n , w , a , x) == 1) ans = to; } if(ans == n + 1) ans = -1; return ans; } else { sort(x , x + a) , x[a] = 2123456789; sort(y , y + b) , y[b] = 2123456789; REP(i , 0 , n){ if(x[a - 1] <= w[i] && y[b - 1] <= s[i]) return -1; else { int v1 = upper_bound(x , x + a + 1 , w[i]) - x; int v2 = upper_bound(y , y + b + 1 , s[i]) - y; sum[a - v1][b - v2] ++; } } REP(i , 0 , a + 1) REP(j , 0 , b + 1){ if(i - 1 >= 0) sum[i][j] += sum[i - 1][j]; if(j - 1 >= 0) sum[i][j] += sum[i][j - 1]; if(i - 1 >= 0 && j - 1 >= 0) sum[i][j] -= sum[i - 1][j - 1]; } int ans = n; RREP(base , 20 , 0){ int to = ans - (1 << base); if(to >= 1){ int ok = 1; REP(i , 0 , a + 1) REP(j , 0 , b + 1){ if((i + j) * to < sum[i][j]){ ok = 0; break; } } if(ok == 1) ans = to; } } return ans; } } #undef int
#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...