제출 #1007525

#제출 시각아이디문제언어결과실행 시간메모리
1007525tosivanmakMisspelling (JOI22_misspelling)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const ll MOD=1e9+7; ll canlare[500005][27],cansmale[500005][27],canall[500005][27]; multiset<ll>prevpos[2]; vector<ll>add[500005],remove[500005]; ll dpcanlare[27],dpcansmale[27],dpcanall[27]; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,m; cin>>n>>m; ll a[m+5],b[m+5]; for(int i=1;i<=m;i++){ cin>>a[i]>>b[i]; ll mul=1; if(a[i]<b[i])mul*=(-1); add[min(a[i],b[i])].push_back(mul*min(a[i],b[i])); remove[max(a[i],b[i])].push_back(mul*max(a[i],b[i])); } for(int i=1;i<=26;i++){ canall[0][i]=i; } for(int i=1;i<=n;i++){ for(int j=1;j<=26;j++){dpcanlare[j]=dpcansmale[j]=dpcanall[j]=0;} // 0 = can only lar, 1 = can only small for(auto& u: add[i]){ if(u<0)prevpos[0].insert(-u); else prevpos[0].insert(u); } for(auto& u: remove[i]){ if(u<0)prevpos[1].erase(prevpos[1].find(-u)); else prevpos[1].erase(prevpos[1].find(u)); } if(prevpos[0].size()==0&&prevpos[1].size()==0){ for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]; dpcanall[j]%=MOD; } } else if(prevpos[0].size()==0){ ll lol=*prevpos[1].rbegin(); for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];) dpcansmale[j]=canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]; dpcanall[j]%=MOD,dpcansmale[j]%=MOD,dpcanlare[j]%=MOD; } } else if(prevpos[1].size()==0){ ll lol=*prevpos[0].rbegin(); for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];) dpcanlare[j]=canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]; dpcanall[j]%=MOD,dpcansmale[j]%=MOD,dpcanlare[j]%=MOD; } } else{ ll lol=*prev[0].rbegin(),lol2=*prev[1].rbegin(); for(int j=1;j<=26;j++){ if(lol==lol2){ for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]); dpcanall[j]%=MOD,dpcansmale[j]%=MOD,dpcanlare[j]%=MOD; } } else if(lol>lol2){ for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]); dpcanlare[j]=canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]-(canall[lol2-1][j-1]+canall[lol2-1][26]-canall[lol2-1][j]+canlare[lol2-1][j-1]+cansmale[lol2-1][26]-cansmale[lol2-1][j]); dpcanall[j]%=MOD,dpcansmale[j]%=MOD,dpcanlare[j]%=MOD; } } else{ for(int j=1;j<=26;j++){ dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol2-1][j-1]+canall[lol2-1][26]-canall[lol2-1][j]+canlare[lol2-1][j-1]+cansmale[lol2-1][26]-cansmale[lol2-1][j]); dpcansmale[j]=canall[lol2-1][j-1]+canall[lol2-1][26]-canall[lol2-1][j]+canlare[lol2-1][j-1]+cansmale[lol2-1][26]-cansmale[lol2-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j]); dpcanall[j]%=MOD,dpcansmale[j]%=MOD,dpcanlare[j]%=MOD; } } } } for(int j=1;j<=26;j++){ canall[i][j]=canall[i-1][j]+canall[i][j-1]-canall[i-1][j-1]+dpcanall[j]; cansmale[i][j]=cansmale[i-1][j]+cansmale[i][j-1]-cansmale[i-1][j-1]+dpcansmale[j]; canlare[i][j]=canlare[i-1][j]+canlare[i][j-1]-canlare[i-1][j-1]+dpcanlarel[j]; canall[j]%=MOD,cansmale[j]%=MOD,canlare[j]%=MOD; } } ll ans=0; for(int j=1;j<=26;j++){ ans+=canall[i][j]-canall[i][j-1]; } cout<<ans<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

misspelling.cpp:7:36: error: 'std::vector<long long int> remove [500005]' redeclared as different kind of entity
    7 | vector<ll>add[500005],remove[500005];
      |                                    ^
In file included from /usr/include/c++/10/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:46,
                 from misspelling.cpp:1:
/usr/include/stdio.h:146:12: note: previous declaration 'int remove(const char*)'
  146 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
misspelling.cpp: In function 'int main()':
misspelling.cpp:20:15: error: invalid types '<unresolved overloaded function type>[const long long int]' for array subscript
   20 |         remove[max(a[i],b[i])].push_back(mul*max(a[i],b[i]));
      |               ^
misspelling.cpp:32:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   32 |         for(auto& u: remove[i]){
      |                            ^
misspelling.cpp:45:243: error: expected ')' before ';' token
   45 |                 dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];)
      |                                                                                                                                  ~                                                                                                                ^
      |                                                                                                                                                                                                                                                   )
misspelling.cpp:45:244: error: expected primary-expression before ')' token
   45 |                 dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];)
      |                                                                                                                                                                                                                                                    ^
misspelling.cpp:53:243: error: expected ')' before ';' token
   53 |                 dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];)
      |                                                                                                                                  ~                                                                                                                ^
      |                                                                                                                                                                                                                                                   )
misspelling.cpp:53:244: error: expected primary-expression before ')' token
   53 |                 dpcanall[j]=canall[i-1][j-1]+canall[i-1][26]-canall[i-1][j]+canlare[i-1][j-1]+cansmale[i-1][26]-cansmale[i-1][j]-(canall[lol-1][j-1]+canall[lol-1][26]-canall[lol-1][j]+canlare[lol-1][j-1]+cansmale[lol-1][26]-cansmale[lol-1][j];)
      |                                                                                                                                                                                                                                                    ^
misspelling.cpp:59:25: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   59 |             ll lol=*prev[0].rbegin(),lol2=*prev[1].rbegin();
      |                         ^
misspelling.cpp:61:25: error: 'lol2' was not declared in this scope; did you mean 'lol'?
   61 |                 if(lol==lol2){
      |                         ^~~~
      |                         lol
misspelling.cpp:86:77: error: 'dpcanlarel' was not declared in this scope; did you mean 'dpcanlare'?
   86 |             canlare[i][j]=canlare[i-1][j]+canlare[i][j-1]-canlare[i-1][j-1]+dpcanlarel[j];
      |                                                                             ^~~~~~~~~~
      |                                                                             dpcanlare
misspelling.cpp:87:22: error: invalid operands of types 'long long int [27]' and 'long long int' to binary 'operator%'
   87 |             canall[j]%=MOD,cansmale[j]%=MOD,canlare[j]%=MOD;
      |             ~~~~~~~~~^~~~~
misspelling.cpp:87:22: note:   in evaluation of 'operator%=(long long int [27], long long int)'
misspelling.cpp:87:39: error: invalid operands of types 'long long int [27]' and 'long long int' to binary 'operator%'
   87 |             canall[j]%=MOD,cansmale[j]%=MOD,canlare[j]%=MOD;
      |                            ~~~~~~~~~~~^~~~~
misspelling.cpp:87:39: note:   in evaluation of 'operator%=(long long int [27], long long int)'
misspelling.cpp:87:55: error: invalid operands of types 'long long int [27]' and 'long long int' to binary 'operator%'
   87 |             canall[j]%=MOD,cansmale[j]%=MOD,canlare[j]%=MOD;
      |                                             ~~~~~~~~~~^~~~~
misspelling.cpp:87:55: note:   in evaluation of 'operator%=(long long int [27], long long int)'
misspelling.cpp:92:21: error: 'i' was not declared in this scope
   92 |         ans+=canall[i][j]-canall[i][j-1];
      |                     ^