Submission #195691

#TimeUsernameProblemLanguageResultExecution timeMemory
195691FieryPhoenixCrayfish scrivener (IOI12_scrivener)C++11
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <cstdio> #include <map> #include <queue> #include <set> #include <iomanip> #include <deque> #include <cassert> #include <ctime> #include <cstring> #include <cstdlib> #include <chrono> #include <ctime> #include <random> #include <stack> #include <unordered_set> #include <unordered_map> #include <iterator> #include <climits> //#include "scrivener.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; typedef long double ld; #define INF 2001001001 #define MOD 1000000007 int nex; int length[1000001]; char c[1000001]; vector<int> anc[1000001]; bool started=false; int log[1000001]; void calcAnc(int ind){ for (int i=1;i<=log[length[ind]]+1;i++){ if (anc[ind][i-1]==-1 || i-1>=(int)anc[anc[ind][i-1]].size()) anc[ind].push_back(-1); else anc[ind].push_back(anc[anc[ind][i-1]][i-1]); } } void Init(){ anc[0].push_back(-1); for (int i=0;i<20;i++) log[1<<i]=i; for (int i=1;i<=1000000;i++) if (log[i]==0) log[i]=log[i-1]; } void TypeLetter(char ch){ if (!started){ c[0]=ch; length[0]=1; nex++; started=true; return; } length[nex]=length[nex-1]+1; c[nex]=ch; anc[nex].push_back(nex-1); calcAnc(nex); nex++; } void UndoCommands(int x){ length[nex]=length[nex-x-1]; c[nex]=c[nex-x-1]; anc[nex].push_back(anc[nex-x-1][0]); calcAnc(nex); nex++; } char GetLetter(int ind){ ind=length[nex-1]-1-ind; int cur=nex-1; for (int i=(int)anc[cur].size()-1;i>=0;i--){ if (((1<<i)&ind)!=0) cur=anc[cur][i]; } return c[cur]; }

Compilation message (stderr)

scrivener.cpp:37:16: error: 'int log [1000001]' redeclared as different kind of symbol
 int log[1000001];
                ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/iostream:38,
                 from scrivener.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:109:1: note: previous declaration 'double log(double)'
 __MATHCALL_VEC (log,, (_Mdouble_ __x));
 ^
scrivener.cpp: In function 'void calcAnc(int)':
scrivener.cpp:40:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   for (int i=1;i<=log[length[ind]]+1;i++){
                                  ^
scrivener.cpp: In function 'void Init()':
scrivener.cpp:51:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
     log[1<<i]=i;
             ^
scrivener.cpp:53:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
     if (log[i]==0)
              ^
scrivener.cpp:54:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
       log[i]=log[i-1];
            ^
scrivener.cpp:54:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
       log[i]=log[i-1];
                     ^