이 제출은 이전 버전의 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=1e6+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];
bool use[MAX];
vector<pair<pii,int>> 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;
}
}
vx.clear();
vy.clear();
for(int i=0;i<T;i++){
if(x[i]==A&&y[i]==B){
return -1;
}
sx.pb({{x[i],y[i]},i});
sy.pb({{y[i],x[i]},i});
}
sort(all(sx));
sort(all(sy));
int ans=T;
int l=1,r=T;
while(l<=r){
int m=(l+r)/2;
int cnt=0;
mem(use,0);
int p=sz(sx)-1;
for(int i=A-1;i>=0;i--){
int f=0;
while(p>=0&&f<m){
if(sx[p].F.F<=i){
use[sx[p].S]=1;
cnt++;
f++;
p--;
}
else{
p--;
}
}
}
p=sz(sy)-1;
for(int i=B-1;i>=0;i--){
int f=0;
while(p>=0&&f<m){
if(use[sy[p].S]){
p--;
continue;
}
if(sy[p].F.F<=i){
use[sy[p].S]=1;
cnt++;
f++;
p--;
}
else p--;
}
}
if(cnt==T){
r=m-1;
ans=m;
}
else l=m+1;
}
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... |