Submission #121232

#TimeUsernameProblemLanguageResultExecution timeMemory
121232baluteshih크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
34 / 100
653 ms262144 KiB
#include <bits/stdc++.h> #define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define pb push_back #define ET cout << "\n" #define MEM(i,j) memset(i,j,sizeof i) #define F first #define S second #define MP make_pair #define ALL(v) v.begin(),v.end() #define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;} using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; struct node { char c; node *l,*r; node(char c=0):c(c),l(0),r(0){} }*root[1000005]; int t,Len[1000005]; const int C=999999; node *modify(int x,int l,int r,node *p,char c) { if(!p) p=new node(); else p=new node(*p); int m=l+r>>1; if(m==x) return p->c=c,p; if(x<m) p->l=modify(x,l,m-1,p->l,c); else p->r=modify(x,m+1,r,p->r,c); return p; } char query(int x,int l,int r,node *p) { int m=l+r>>1; if(m==x) return p->c; if(x<m) return query(x,l,m-1,p->l); return query(x,m+1,r,p->r); } void Init(){ t=0,Len[0]=-1; } void TypeLetter(char L) { ++t,root[t]=modify(Len[t-1]+1,0,C,root[t-1],L),Len[t]=Len[t-1]+1; } void UndoCommands(int U) { ++t,root[t]=root[t-U-1],Len[t]=Len[t-U-1]; } char GetLetter(int P) { return query(P,0,C,root[t]); }

Compilation message (stderr)

scrivener.cpp: In function 'node* modify(int, int, int, node*, char)':
scrivener.cpp:30:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m=l+r>>1;
        ~^~
scrivener.cpp: In function 'char query(int, int, int, node*)':
scrivener.cpp:39:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m=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...