Submission #426610

#TimeUsernameProblemLanguageResultExecution timeMemory
426610SAADRobots (IOI13_robots)C++17
53 / 100
344 ms12916 KiB
#define F first #define S second #define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1)) #define pb push_back #define Fbitl __builtin_ffs #define bit1 __builtin_popcount //#include <bits/stdc++.h> #include <iostream> #include <math.h> #include <algorithm> #include <string.h> #include <vector> #include <queue> #include <map> #include <unordered_map> #include "robots.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<vl> vvl; bool visa[(int)1e6]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector <pair<int, int>> x, y; for (int i = 0; i < T; i++) { x.pb({ W[i],i }); y.pb({ S[i],i }); } int c = A, res = 0; sort(y.begin(), y.end()); sort(x.begin(), x.end()); sort(X, X + A); sort(Y, Y + B); bool th = true; int TT = T; while (TT && th) { c = A; th = false; for (int i = T - 1; i >= 0 && c; i--) { if (visa[x[i].S]) continue; if (x[i].F < X[c - 1]) { x[i].F = 0; visa[x[i].S] = true; c--; TT--; th = true; } } c = B; for (int i = T - 1; i >= 0 && c; i--) { if (visa[y[i].S]) continue; if (y[i].F < Y[c - 1]) { visa[y[i].S] = true; c--; TT--; th = true; } } res++; } return (th ? res : -1); }
#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...