제출 #152229

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1522292019-09-06 21:17:48TadijaSebez새 집 (APIO18_new_home)C++11
80 / 100
5021 ms437260 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define l_type 0
#define r_type 1
const int N=300050;
const int mxx=1e8;
int x[N],t[N],a[N],b[N],qx[N],qt[N],n,q,k,ans[N],myl[N],myr[N];
struct cmp{ bool operator () (int i, int j) const { return x[i]<x[j] || (x[i]==x[j] && i<j);}};
set<int,cmp> house[N];
const int H=8*N;
int type[H],l[H],r[H],tl[H],tr[H],hsz;
int act[N],active,cur_time;
int Seg(int ty, int _l, int _r, int _tl){ hsz++;type[hsz]=ty;l[hsz]=_l;r[hsz]=_r;tl[hsz]=_tl;tr[hsz]=-1;return hsz;}
void S(int i, int j)
{
if(i==0) myr[j]=Seg(r_type,1,x[j],cur_time);
else if(j==0) myl[i]=Seg(l_type,x[i],mxx,cur_time);
else
{
int mid=x[i]+x[j]>>1;
myl[i]=Seg(l_type,x[i],mid,cur_time);
myr[j]=Seg(r_type,mid+((x[j]-x[i])%2==1),x[j],cur_time);
}
}
void E(int i, int j)
{
if(i!=0) tr[myl[i]]=cur_time-1;
if(j!=0) tr[myr[j]]=cur_time-1;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

new_home.cpp: In function 'void S(int, int)':
new_home.cpp:21:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid=x[i]+x[j]>>1;
                 ~~~~^~~~~
new_home.cpp: In function 'void Build(int&, int, int, std::vector<int>, std::vector<int>)':
new_home.cpp:74:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 int mid=ss+se>>1;
         ~~^~~
new_home.cpp: In function 'int GetL(int, int, int, int)':
new_home.cpp:99:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(l_ptr[c]<lst[c].size() && r[lst[c][l_ptr[c]]]<qx[id]) l_ptr[c]++;
        ~~~~~~~~^~~~~~~~~~~~~~
new_home.cpp:100:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  int ans=l_ptr[c]==lst[c].size()?0:qx[id]-l[lst[c][l_ptr[c]]];
          ~~~~~~~~^~~~~~~~~~~~~~~
new_home.cpp:102:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int mid=ss+se>>1;
          ~~^~~
new_home.cpp: In function 'int GetR(int, int, int, int)':
new_home.cpp:109:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(r_ptr[c]<rst[c].size() && l[rst[c][r_ptr[c]]]>qx[id]) r_ptr[c]++;
        ~~~~~~~~^~~~~~~~~~~~~~
new_home.cpp:110:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  int ans=r_ptr[c]==rst[c].size()?0:r[rst[c][r_ptr[c]]]-qx[id];
          ~~~~~~~~^~~~~~~~~~~~~~~
new_home.cpp:112:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int mid=ss+se>>1;
          ~~^~~
new_home.cpp: In function 'int main()':
new_home.cpp:126:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<events.size();i++)
              ~^~~~~~~~~~~~~~
new_home.cpp:119:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i %i",&n,&k,&q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
new_home.cpp:121:88: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%i %i %i %i",&x[i],&t[i],&a[i],&b[i]),events.pb({a[i],i}),events.pb({b[i]+1,-i});
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:122:75: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=q;i++) scanf("%i %i",&qx[i],&qt[i]),events.pb({qt[i],n+i}),cmpr_time.pb(qt[i]);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...