Submission #311063

#TimeUsernameProblemLanguageResultExecution timeMemory
311063tigichaLottery (CEOI18_lot)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int n, l, q, k, t, a[100005], b[100005], mas[100005], array[100005][105], ans[100005][105]; pair<int, int>ar[100005]; int main(){ cin>>n>>l; for(int i=1; i<=n; i++) cin>>a[i]; cin>>q; for(int i=1; i<=q; i++){ cin>>ar[i].first; ar[i].second=i; } sort(ar+1, ar+q+1); k=1; for(int i=0; i<=n; i++){ while(ar[k].first<i && k<=q) k++; mas[i]=k; } for(int i=1; i<=n; i++){ for(int j=1; j<=n-i; j++){ b[j]=0; if(a[j]!=a[i+j]) b[j]=1; } for(int j=1; j<=n-i; j++){ b[j]+=b[j-1]; if(j>=l){ t=b[j]-b[j-l]; array[j-l+1][mas[t]]++; array[j+i-l+1][mas[t]]++; } } } for(int i=1; i<=q; i++) for(int j=1; j<=n-l+1; j++) ans[j][ar[i].second]=array[j][i]+ans[j][ar[i-1].second]; for(int i=1; i<=q; i++){ for(int j=1; j<=n-l+1; j++) cout<<ans[j][i]<<" "; cout<<endl; } return 0; }

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:31:5: error: reference to 'array' is ambiguous
   31 |     array[j-l+1][mas[t]]++;
      |     ^~~~~
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:71,
                 from lot.cpp:1:
/usr/include/c++/9/array:94:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   94 |     struct array
      |            ^~~~~
lot.cpp:3:55: note:                 'int array [100005][105]'
    3 | int n, l, q, k, t, a[100005], b[100005], mas[100005], array[100005][105], ans[100005][105];
      |                                                       ^~~~~
lot.cpp:32:5: error: reference to 'array' is ambiguous
   32 |     array[j+i-l+1][mas[t]]++;
      |     ^~~~~
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:71,
                 from lot.cpp:1:
/usr/include/c++/9/array:94:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   94 |     struct array
      |            ^~~~~
lot.cpp:3:55: note:                 'int array [100005][105]'
    3 | int n, l, q, k, t, a[100005], b[100005], mas[100005], array[100005][105], ans[100005][105];
      |                                                       ^~~~~
lot.cpp:38:23: error: reference to 'array' is ambiguous
   38 |  ans[j][ar[i].second]=array[j][i]+ans[j][ar[i-1].second];
      |                       ^~~~~
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:71,
                 from lot.cpp:1:
/usr/include/c++/9/array:94:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   94 |     struct array
      |            ^~~~~
lot.cpp:3:55: note:                 'int array [100005][105]'
    3 | int n, l, q, k, t, a[100005], b[100005], mas[100005], array[100005][105], ans[100005][105];
      |                                                       ^~~~~
lot.cpp:40:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   40 |      for(int j=1; j<=n-l+1; j++)
      |      ^~~
lot.cpp:42:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   42 |   cout<<endl;
      |   ^~~~