제출 #718612

#제출 시각아이디문제언어결과실행 시간메모리
718612firewater로봇 (IOI13_robots)C++14
90 / 100
3085 ms11080 KiB
#include "robots.h" #pragma GCC optimize(3) #pragma GCC target("avx,sse2,sse3,sse4,mmx") #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-fwhole-program") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("inline-functions") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") #pragma GCC optimize("-fstrict-overflow") #pragma GCC optimize("-falign-functions") #pragma GCC optimize("-fcse-skip-blocks") #pragma GCC optimize("-fcse-follow-jumps") #pragma GCC optimize("-fsched-interblock") #pragma GCC optimize("-fpartial-inlining") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("inline-small-functions") #pragma GCC optimize("-finline-small-functions") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("-funsafe-loop-optimizations") #pragma GCC optimize("inline-functions-called-once") #pragma GCC optimize("-fdelete-null-pointer-checks") #include<queue> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define ll long long #define N 1001000 #define mp make_pair #define fs first #define sn second using namespace std; int l,r,now,a[N],b[N]; pair<int,int>s[N]; priority_queue<int>d; bool check(int t,int A, int B, int T) { while(!d.empty())d.pop(); now=1; for(int i=1;i<=A;++i){ while(now<=T&&s[now].fs<a[i])d.push(s[now++].sn); for(int j=1;j<=t&&!d.empty();++j) d.pop(); } while(now<=T&&d.size()<=B*t)d.push(s[now++].sn); if(d.size()>B*t)return false; for(int i=B;i>0&&!d.empty();--i) for(int j=1;j<=t&&!d.empty();++j) if(d.top()<b[i])d.pop(); return d.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i=1;i<=A;++i) a[i]=X[i-1]; for(int i=1;i<=B;++i) b[i]=Y[i-1]; for(int i=1;i<=T;++i) s[i]=mp(W[i-1],S[i-1]); sort(a+1,a+1+A); sort(b+1,b+1+B); sort(s+1,s+1+T); if(!check(T,A,B,T))return -1; l=(T+(A+B)-1)/(A+B); r=T; while(l<r) { int mid=l+r>>1; if(check(mid,A,B,T))r=mid; else l=mid+1; } return l; }

컴파일 시 표준 에러 (stderr) 메시지

robots.cpp:23:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
   23 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
robots.cpp:30:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
   30 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
robots.cpp:32:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
   32 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
robots.cpp:46:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
   46 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
robots.cpp:63:37: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   63 | bool check(int t,int A, int B, int T)
      |                                     ^
robots.cpp:63:37: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
robots.cpp:63:37: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
robots.cpp:63:37: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
robots.cpp: In function 'bool check(int, int, int, int)':
robots.cpp:72:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   72 |  while(now<=T&&d.size()<=B*t)d.push(s[now++].sn);
      |                ~~~~~~~~^~~~~
robots.cpp:73:13: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   73 |  if(d.size()>B*t)return false;
      |     ~~~~~~~~^~~~
robots.cpp: At global scope:
robots.cpp:79:68: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   79 | int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
      |                                                                    ^
robots.cpp:79:68: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
robots.cpp:79:68: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
robots.cpp:79:68: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:94:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   94 |   int mid=l+r>>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...