Submission #729024

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7290242023-04-23 11:58:07MilosMilutinovicPassport (JOI23_passport)C++14
100 / 100
1413 ms90756 KiB
#include <bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
int n,q,l[800005],r[800005],dl[800005],dr[800005],dis[800005],idx[200005];
vector<int> g[800005];
void bfs(int* d)
{
set<pair<int,int>> st;
for(int i=1;i<=n;i++) st.emplace(d[i],i);
while(!st.empty())
{
auto it=st.begin();
int x=it->second;
st.erase(it);
if(x<=n)
{
for(int y=idx[x];y>=1;y/=2)
{
if(d[n+y]>d[x])
{
if(st.find({d[n+y],n+y})!=st.end()) st.erase(st.find({d[n+y],n+y}));
d[n+y]=d[x];st.emplace(d[n+y],n+y);
}
}
}
else
{
for(int y:g[x])
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

passport.cpp: In function 'void build(int, int, int)':
passport.cpp:46:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   46 |     int mid=l+r>>1;
      |             ~^~
passport.cpp: In function 'void add(int, int, int, int, int, int)':
passport.cpp:59:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   59 |     int mid=l+r>>1;
      |             ~^~
passport.cpp: In function 'int main()':
passport.cpp:66:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
passport.cpp:67:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   67 |     for(int i=1;i<=n;i++) scanf("%d%d",&l[i],&r[i]);
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~
passport.cpp:77:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |     scanf("%d",&q);
      |     ~~~~~^~~~~~~~~
passport.cpp:80:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   80 |         int x;scanf("%d",&x);
      |               ~~~~~^~~~~~~~~
#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...