제출 #228914

#제출 시각아이디문제언어결과실행 시간메모리
228914blacktulipSimple (info1cup19_simple)C++17
30 / 100
388 ms18680 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define int long long #define mp make_pair #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo MAX = -1000000000000000000; const lo MIN = 1000000000000000000; const lo inf = 1000000000000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 200005; const lo mod = 1000000007; int n,m,b[li],a[li],k,flag,t,tree[li*4],tree1[li*4]; int cev; string s; vector<int> v; inline void build(int node,int start,int end){ if(start>end)return ; if(start==end){tree[node]=a[start]*(a[start]%2==0?-1:1);return ;} build(node*2,start,mid),build(node*2+1,mid+1,end); tree[node]=max(tree[node*2],tree[node*2+1]); } inline void build1(int node,int start,int end){ if(start>end)return ; if(start==end){tree1[node]=(a[start]%2==0?a[start]:inf);return ;} build1(node*2,start,mid),build1(node*2+1,mid+1,end); tree1[node]=min(tree1[node*2],tree1[node*2+1]); } inline int query(int node,int start,int end,int l,int r){ if(start>end || start>r || end<l)return -inf; if(start>=l && end<=r){return tree[node];} return max(query(node*2,start,mid,l,r),query(node*2+1,mid+1,end,l,r)); } inline int query1(int node,int start,int end,int l,int r){ if(start>end || start>r || end<l)return inf; if(start>=l && end<=r){return tree1[node];} return min(query1(node*2,start,mid,l,r),query1(node*2+1,mid+1,end,l,r)); } main(void){ //~ freopen("simple.txt","r",stdin); //~ printf("**\n"); scanf("%lld",&n); FOR{ scanf("%lld",&a[i]); } scanf("%lld",&t); build(1,1,n); build1(1,1,n); //~ int ok=0; while(t--){ int type,x,y; scanf("%lld %lld %lld",&type,&x,&y); //~ if(type==0){printf("()\n");return 0;} if(type==1){ int say=query1(1,1,n,x,y); int say1=query(1,1,n,x,y); if(abs(say)%2==1 || say==inf || say<0)say=-1; if(abs(say1)%2==0 || say1==-inf || say1<0)say1=-1; printf("%lld %lld\n",say,say1); } //~ ok++; //~ if(ok==10) //~ return 0; } return 0; }

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

subway.cpp:57:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(void){
          ^
subway.cpp: In function 'int main()':
subway.cpp:60:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
subway.cpp:62:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
subway.cpp:64:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&t);
  ~~~~~^~~~~~~~~~~
subway.cpp:70:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld",&type,&x,&y);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...