이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include <bits/stdc++.h>
#pragma optimize("Ofast")
#pragma target("avx2")
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
// #define int ll
const int MAX=2e6+15;
const int N=104;
const ll inf=1e18;
const int mod=1e9+7;
const int mod1=1e9+9;
const ld eps=1e-9;
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
int binpow(int a,int n){
if(!n)return 1;
if(n%2==1)return a*binpow(a,n-1)%mod;
int k=binpow(a,n/2);
return k*k%mod;
}
#include "robots.h"
int x[MAX],y[MAX];
multiset<pii> sx,sy;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int H[]) {
vector<pii> vx;
vector<pii> vy;
for(int i=0;i<A;i++)X[i]--;
for(int i=0;i<B;i++)Y[i]--;
for(int i=0;i<A;i++){
vx.pb({X[i],T});
}
for(int i=0;i<B;i++){
vy.pb({Y[i],T});
}
for(int i=0;i<T;i++){
vx.pb({W[i],i});
vy.pb({H[i],i});
}
sort(all(vx));
sort(all(vy));
int cA=0,cB=0;
for(int i=0;i<sz(vx);i++){
if(vx[i].S==T){
cA++;
}
else{
x[vx[i].S]=cA;
}
}
for(int i=0;i<sz(vy);i++){
if(vy[i].S==T){
cB++;
}
else{
y[vy[i].S]=cB;
}
}
for(int i=0;i<T;i++){
if(x[i]==A&&y[i]==B){
return -1;
}
sx.in({x[i],y[i]});
sy.in({y[i],x[i]});
}
int ans=0;
while(!sx.empty()){
ans++;
if(ans>1000)return -1;
for(int i=A-1;i>=0;i--){
if(sx.empty())break;
auto pos=sx.ub({i,B});
if(pos==sx.begin())break;
pos--;
sy.erase(sy.find({pos->S,pos->F}));
sx.erase(pos);
}
for(int i=B-1;i>=0;i--){
if(sy.empty())break;
auto pos=sy.ub({i,A});
if(pos==sy.begin())break;
pos--;
sx.erase(sx.find({pos->S,pos->F}));
sy.erase(pos);
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
robots.cpp:4: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
4 | #pragma optimize("Ofast")
|
robots.cpp:5: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
5 | #pragma target("avx2")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |