제출 #281955

#제출 시각아이디문제언어결과실행 시간메모리
281955Atill83Permutation Recovery (info1cup17_permutation)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ff first #define ss second #define endl '\n' using namespace std; const long long INF = (long long) 1e18; const long long mod = (long long) 1e9+7; const int MAXN = (int) 7e4+5; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; ll n; int q[MAXN]; const int bs = 270; unordered_map<int, int> mp[MAXN]; int Dec[MAXN]; int ans[MAXN]; int del[MAXN]; int pw[100001][10]; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); #ifdef Local freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin); freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout); #endif cin>>n; pw[0][1] = 1; for(int i = 0; i <= 100000; i++){ pw[i][0] = 0; if(i != 0) pw[i][1] = 1LL*pw[i - 1][1]*10%mod; for(int j = 2; j < 10; j++){ pw[i][j] = 1LL*pw[i][1]*j%mod; } } for(int i = 0; i < n; i++){ string s; cin>>s; int cnt = s.length() - 1; for(char c: s){ int cur = c - '0'; del[i] += pw[cnt][cur]; if(del[i] >= mod) del[i] -= mod; cnt--; } } int bc = (n + bs - 1) / bs; for(int i = 0; i < bc; i++){ for(int j = i*bs; j < min(n, (i + 1)*bs); j++){ q[j] = del[j] - (j == 0 ? 0 : del[j - 1]); if(q[j] < 0) q[j] += mod; mp[i][q[j]]++; //cerr<<q[j]<<endl; } } for(int i = 1; i <= n; i++){ int curB = bc - 1; while(curB >= 0 && mp[curB][(1 + Dec[curB])%mod] == 0){ curB--; //assert(curB != -1); } if(curB < 0) break; int idx = -1; for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){ if(ans[j]) continue; if(q[j] == (1 + Dec[curB])%mod){ ans[j] = i; mp[curB].clear(); idx = j; break; } } int deg = 0; for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){ if(ans[j]){ if(j == idx){ deg = del[j] - (j == 0 ? 0 : del[j - 1]); if(deg < 0) deg += mod; } continue; } q[j] -= deg; if(q[j] < 0) q[j] += mod; mp[curB][q[j]]++; } for(int j = curB + 1; j < bc; j++){ Dec[j] += deg; if(Dec[j] >= mod) Dec[j] -= mod; } } for(int i = 0; i < n; i++) cout<<ans[i]<<" "; #ifdef Local cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds "; #endif }

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

permutation.cpp: In function 'int main()':
permutation.cpp:55:48: error: no matching function for call to 'min(ll&, int)'
   55 |         for(int j = i*bs; j < min(n, (i + 1)*bs); j++){
      |                                                ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
permutation.cpp:55:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   55 |         for(int j = i*bs; j < min(n, (i + 1)*bs); j++){
      |                                                ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
permutation.cpp:55:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   55 |         for(int j = i*bs; j < min(n, (i + 1)*bs); j++){
      |                                                ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
permutation.cpp:55:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   55 |         for(int j = i*bs; j < min(n, (i + 1)*bs); j++){
      |                                                ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
permutation.cpp:55:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   55 |         for(int j = i*bs; j < min(n, (i + 1)*bs); j++){
      |                                                ^
permutation.cpp:71:49: error: no matching function for call to 'min(ll, int)'
   71 |         for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){
      |                                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
permutation.cpp:71:49: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   71 |         for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){
      |                                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
permutation.cpp:71:49: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   71 |         for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){
      |                                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
permutation.cpp:71:49: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   71 |         for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){
      |                                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
permutation.cpp:71:49: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   71 |         for(int j = min(n - 1, (curB + 1)*bs - 1); j >= curB*bs; j--){
      |                                                 ^
permutation.cpp:81:54: error: no matching function for call to 'min(int, ll&)'
   81 |         for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){
      |                                                      ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
permutation.cpp:81:54: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   81 |         for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){
      |                                                      ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
permutation.cpp:81:54: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   81 |         for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){
      |                                                      ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
permutation.cpp:81:54: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   81 |         for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){
      |                                                      ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from permutation.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
permutation.cpp:81:54: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   81 |         for(int j = bs*curB; j < min(bs*(curB + 1), n); j++){
      |                                                      ^