Submission #1022715

#TimeUsernameProblemLanguageResultExecution timeMemory
1022715vjudge1Crayfish scrivener (IOI12_scrivener)C++17
34 / 100
45 ms52180 KiB
#include<bits/stdc++.h> using namespace std; char last; vector<int>rt,sz; #define N 3<<20 int ch[N][2],CC; int nn(int a,int b){ ch[++CC][0]=a; ch[CC][1]=b; return CC; } int nn(int v){ ch[++CC][0]=v; return CC; } int upd(int i,int l,int r,int p,int v){ if(l==r)return nn(v); if(l+r>>1<p) return nn(ch[i][0],upd(ch[i][1],l+r+2>>1,r,p,v)); else return nn(upd(ch[i][0],l,l+r>>1,p,v),ch[i][1]); } int query(int i,int l,int r,int p){ if(l==r)return ch[i][0]; if(l+r>>1>=p) return query(ch[i][0],l,l+r>>1,p); return query(ch[i][1],l+r+2>>1,r,p); } int buildt(int l,int r){ if(l==r)return nn('a'); return nn(buildt(l,l+r>>1), buildt(l+r+2>>1,r)); } void Init() { rt.push_back(buildt(1,1e6)); sz.push_back(1); } void TypeLetter(char L) { rt.push_back(upd(rt.back(),1,1e6,sz.back(),L)); sz.push_back(sz.back()+1); } void UndoCommands(int U) { rt.push_back(rt[rt.size()-U-1]); sz.push_back(sz[sz.size()-U-1]); } char GetLetter(int P) { return query(rt.back(),1,1e6,P+1); }

Compilation message (stderr)

scrivener.cpp: In function 'int upd(int, int, int, int, int)':
scrivener.cpp:17:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   17 |     if(l==r)return nn(v); if(l+r>>1<p)
      |     ^~
scrivener.cpp:17:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   17 |     if(l==r)return nn(v); if(l+r>>1<p)
      |                           ^~
scrivener.cpp:17:31: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   17 |     if(l==r)return nn(v); if(l+r>>1<p)
      |                              ~^~
scrivener.cpp:18:44: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   18 |         return nn(ch[i][0],upd(ch[i][1],l+r+2>>1,r,p,v));
      |                                         ~~~^~
scrivener.cpp:19:36: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   19 |     else return nn(upd(ch[i][0],l,l+r>>1,p,v),ch[i][1]);
      |                                   ~^~
scrivener.cpp: In function 'int query(int, int, int, int)':
scrivener.cpp:23:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   23 |     if(l+r>>1>=p)
      |        ~^~
scrivener.cpp:24:34: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |         return query(ch[i][0],l,l+r>>1,p);
      |                                 ~^~
scrivener.cpp:25:30: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |     return query(ch[i][1],l+r+2>>1,r,p);
      |                           ~~~^~
scrivener.cpp: In function 'int buildt(int, int)':
scrivener.cpp:29:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |     return nn(buildt(l,l+r>>1),
      |                        ~^~
scrivener.cpp:30:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |             buildt(l+r+2>>1,r));
      |                    ~~~^~
#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...