QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#428648#8774. Manhattan Walkucup-team3646#Compile Error//C++173.4kb2024-06-01 20:49:042024-06-01 20:49:06

Judging History

你现在查看的是最新测评结果

  • [2024-06-01 20:49:06]
  • 评测
  • [2024-06-01 20:49:04]
  • 提交

answer

a

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define elif else if
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>


#define repname(a, b, c, d, e, ...) e
#define rep(...)                    repname(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
#define rep0(x)                     for (int rep_counter = 0; rep_counter < (x); ++rep_counter)
#define rep1(i, x)                  for (int i = 0; i < (x); ++i)
#define rep2(i, l, r)               for (int i = (l); i < (r); ++i)
#define rep3(i, l, r, c)            for (int i = (l); i < (r); i += (c))





struct ScalarInput {
    template<class T>
    operator T(){
        T ret;
        cin >> ret;
        return ret;
    }
};
struct VectorInput {
    size_t n;
    VectorInput(size_t n): n(n) {}
    template<class T>
    operator vector<T>(){
        vector<T> ret(n);
        for(T &x : ret) cin >> x;
        return ret;
    }
};
ScalarInput input(){ return ScalarInput(); }
VectorInput input(size_t n){ return VectorInput(n); }

template<typename T>
void print(vector<T> a){
  for(int i=0;i<a.size();i++){
    cout<<a[i]<<" \n"[i+1==a.size()];
  }
}

template<class T>
void print(T x){
    cout << x << '\n';
}
 
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){
  cout << head << ' ';
  print(forward<Tail>(tail)...);
}


int main(){
  //ios::sync_with_stdio(false);
  //cin.tie(nullptr);

  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;

  if(n<3){
    print(-1);
    exit(0);
  }

  // left
  int nL=n/2;
  int nR=n-nL;

  map<array<int,3>,string>mp;
  mp[{0,0,0}]="";
  rep(i,nL){
    vector<pair<char,int>>cand;
    if(s[i]=='A'||s[i]=='?'){
      cand.push_back({'A',0});
    }
    if(s[i]=='N'||s[i]=='?'){
      cand.push_back({'N',1});
    }
    if(s[i]=='C'||s[i]=='?'){
      cand.push_back({'C',2});
    }
    if(s[i]!='A'&&s[i]!='N'&&s[i]!='C'&&s[i]!='?'){
      cand.push_back({s[i],-1});
    }
    if(s[i]=='?'){
      cand.push_back({'B',-1});
    }
    map<array<int,3>,string>new_mp;
    for(auto [abc,t]:mp){
      auto [a,b,c]=abc;
      for(auto [si,f]:cand){
        if(f==0){
          new_mp[{a+1,b,c}]=t+si;
        }
        elif(f==1){
          new_mp[{a,b+a,c}]=t+si;
        }
        elif(f==2){
          new_mp[{a,b,c+b}]=t+si;
        }
        else{
          new_mp[{a,b,c}]=t+si;
        }
      }
    }
    mp=new_mp;
  }


  map<array<int,3>,string>mp2;
  mp2[{0,0,0}]="";
  rep(j,nR){
    int i=n-1-j;
    vector<pair<char,int>>cand;
    if(s[i]=='C'||s[i]=='?'){
      cand.push_back({'C',0});
    }
    if(s[i]=='N'||s[i]=='?'){
      cand.push_back({'N',1});
    }
    if(s[i]=='A'||s[i]=='?'){
      cand.push_back({'A',2});
    }
    if(s[i]!='A'&&s[i]!='N'&&s[i]!='C'&&s[i]!='?'){
      cand.push_back({s[i],-1});
    }
    if(s[i]=='?'){
      cand.push_back({'B',-1});
    }
    map<array<int,3>,string>new_mp;
    for(auto [abc,t]:mp2){
      auto [a,b,c]=abc;
      for(auto [si,f]:cand){
        if(f==0){
          new_mp[{a+1,b,c}]=t+si;
        }
        elif(f==1){
          new_mp[{a,b+a,c}]=t+si;
        }
        elif(f==2){
          new_mp[{a,b,c+b}]=t+si;
        }
        else{
          new_mp[{a,b,c}]=t+si;
        }
      }
    }
    mp2=new_mp;
  }

  print(mp.size(),mp2.size());
}

Details

answer.code:1:1: error: ‘a’ does not name a type
    1 | a
      | ^
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:3:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/cstddef:50,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:510:26: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:57: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1357:46: error: template argument 1 is invalid
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/13/type_traits:1357:46: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1359:26: error: ‘std::size_t’ has not been declared
 1359 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:1360:21: error: ‘_Size’ was not declared in this scope
 1360 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/13/type_traits:1360:27: error: template argument 1 is invalid
 1360 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/13/type_traits:1361:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1361 |     ...