이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
//#define int long long
#define pb push_back
#define s second
#define f first
#define pf push_front
#define inf 100000000000000000
#define bitebi __builtin_popcountll
#define FOR( i , n ) for( int i = 0 ; i < n ; i ++ )
#define YES cout <<"YES\n"
#define NO cout << "NO\n"
#define debug cout << "Here Fine" << endl ;
#define pr pair < int , int >
#define fbo find_by_order // returns iterator
#define ook order_of_key // returns strictly less numbers than key
using namespace std ;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const double Pi=acos(-1.0);
const double EPS=1E-8;
const int mod = 1000000007 ;
const int mod1 = 998244353 ;
const int NN = 2e6 + 10 ;
mt19937 R(time(0));
map < int , int > ma , ma1 ;
int been[ NN ] ;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){
int a = 0 , b = 0 ;
FOR( i , A ) a = max( a , X[ i ] ) ;
FOR( i , B ) b = max( b , Y[ i ] ) ;
int aa = 0 , bb = 0 ;
FOR( i , T ){
aa = max( aa , W[ i ] ) ;
bb = max( bb , S[ i ] ) ;
}
int tt = 0 ;
FOR( i , T ){
if( W[ i ] >= aa && S[ i ] >= bb ) tt = -1 ;
}
if( tt == -1 ) return -1 ;
vector < pair < int , int > > v ;
FOR( i , T ) v.pb( { W[ i ] , S[ i ] } ) ;
sort( v.begin() , v.end() ) ;
// rorame check-isas B = 0 chaamate
sort( X , X + A ) ;
sort( Y , Y + B ) ;
FOR( i , T + 1 ){
int cc = 0 ;
if( i == 0 ) continue ;
FOR( i , T ) been[ i ] = 0 ;
FOR( l , A ){
int x = X[ l ] ;
int cnt = i ;
while( cnt -- ){
int tt = 0 ;
pair < int , int > mx = { 0 , 0 } ;
FOR( j , T ){
if( been[ j ] == 1 ) continue ;
if( v[ j ].f >= x ) break ;
if( v[ j ].s > mx.f ){
mx = { v[ j ].s , j } ;
tt = 1 ;
}
}
if( tt == 0 ) break ;
been[ mx.s ] = 1 ;
cc ++ ;
}
}
vector < int > K ;
FOR( j , T ){
if( been[ j ] == 1 ) continue ;
K.pb( v[ j ].s ) ;
}
sort( K.begin() , K.end() ) ;
int pos = K.size() - 1 ;
for( int j = B - 1 ; j >= 0 ; j -- ){
int x = Y[ j ] ;
int cnt = i ;
while( cnt -- ){
if( pos == -1 ) break ;
if( K[ pos ] < x ){
cc ++ ;
pos -- ;
}
}
}
if( cc == T ) return i ;
}
}
//#define MAX_A 50000
//#define MAX_B 50000
//#define MAX_T 500000
//
//static int X[MAX_A];
//static int Y[MAX_B];
//static int W[MAX_T];
//static int S[MAX_T];
//
//int main() {
// int A, B, T, i;
//
// assert(scanf("%d", &A) == 1);
// assert(scanf("%d", &B) == 1);
// assert(scanf("%d", &T) == 1);
//
// for (i = 0; i < A; i++)
// assert(scanf("%d", &X[i]) == 1);
// for (i = 0; i < B; i++)
// assert(scanf("%d", &Y[i]) == 1);
// for (i = 0; i < T; i++)
// assert(scanf("%d%d", &W[i], &S[i]) == 2);
//
// int answer = putaway(A, B, T, X, Y, W, S);
//
// printf("%d\n", answer);
//
// return 0;
//}
컴파일 시 표준 에러 (stderr) 메시지
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:48:32: warning: control reaches end of non-void function [-Wreturn-type]
48 | vector < pair < int , int > > v ;
| ^
# | 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... |