Submission #1138299

#TimeUsernameProblemLanguageResultExecution timeMemory
1138299KhoaDuyStray Cat (JOI20_stray)C++20
Compilation error
0 ms0 KiB
#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> pat={0,1,0,0,1,1};
vector<vector<pair<int,int>>> graph;
void DFS(int u,int p,vector<int> &val,int last){
    if(graph[u].size()==2){
        for(pair<int,int> &x:graph[u]){
            int v=x.first,idx=x.second;
            if(v!=p){
                val[idx]=pat[(last+1)%pat.size()];
                DFS(v,u,val,(last+1)%pat.size());
            }
        }
    }
    else{
        for(pair<int,int> &x:graph[u]){
            int v=x.first,idx=x.second;
            if(v!=p){
                val[idx]=(pat[last]^1);
                DFS(v,u,val,val[idx]);
            }
        }
    }
}
vector<int> Mark(int n,int m,int a,int b,vector<int> e1,vector<int> e2){
    if(b==0){
        return {};
    }
    graph.clear();
    graph.resize(n);
    for(int i=0;i<m;i++){
        graph[e1[i]].push_back({e2[i],i});
        graph[e2[i]].push_back({e1[i],i});
    }
    vector<int> val(m);
    DFS(0,-1,val,5);
    return val;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> pat={0,1,0,0,1,1};
int a,b;
void Init(int A,int B){
    seq.clear();
    seq.resize(0);
    know=false;
    last=-1;
    a=A,b=B;
}
int Move(vector<int> y){
    if(b==0){
        return -1;
    }
    int deg=(last!=-1);
    for(int i=0;i<a;i++){
        deg+=y[i];
    }
    if(deg==2){
        if(know){
            for(int i=0;i<a;i++){
                if(y[i]>0){
                    last=i;
                    return i;
                }
            }
        }
        for(int i=0;i<a;i++){
            for(int j=0;j<y[i];j++){
                seq.push_back(i);
            }
        }
        if(seq.size()==5){
            bool wrong=false;
            for(int i=0;i<pat.size();i++){
                bool flag=true;
                for(int j=0;j<seq.size();j++){
                    if(seq[j]!=pat[(i+j)%pat.size()]){
                        flag=false;
                        break;
                    }
                }
                if(flag){
                    wrong=true;
                    break;
                }
            }
            seq.clear();
            seq.resize(0);
            know=true;
            if(wrong){
                return -1;
            }
            last=seq.back();
            return seq.back();
        }
        last=seq.back();
        return last;
    }
    else{
        if(last!=-1){
            y[last]++;
        }
        int Minidx=0;
        for(int i=1;i<a;i++){
            if(y[i]<y[Minidx]){
                Minidx=i;
            }
        }
        know=true;
        if(last==Minidx){
            return -1;
        }
        last=Minidx;
        return Minidx;
    }
}

Compilation message (stderr)

# 2번째 컴파일 단계

Catherine.cpp: In function 'void Init(int, int)':
Catherine.cpp:7:5: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
    7 |     seq.clear();
      |     ^~~
      |     __pstl::execution::v1::seq
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Catherine.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:110:28: note: '__pstl::execution::v1::seq' declared here
  110 | constexpr sequenced_policy seq{};
      |                            ^~~
Catherine.cpp:9:5: error: 'know' was not declared in this scope
    9 |     know=false;
      |     ^~~~
Catherine.cpp:10:5: error: 'last' was not declared in this scope; did you mean 'std::chrono::last'?
   10 |     last=-1;
      |     ^~~~
      |     std::chrono::last
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:101,
                 from Catherine.cpp:2:
/usr/include/c++/11/chrono:1276:32: note: 'std::chrono::last' declared here
 1276 |     inline constexpr last_spec last{};
      |                                ^~~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:17:14: error: 'last' was not declared in this scope; did you mean 'std::chrono::last'?
   17 |     int deg=(last!=-1);
      |              ^~~~
      |              std::chrono::last
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:101,
                 from Catherine.cpp:2:
/usr/include/c++/11/chrono:1276:32: note: 'std::chrono::last' declared here
 1276 |     inline constexpr last_spec last{};
      |                                ^~~~
Catherine.cpp:22:12: error: 'know' was not declared in this scope
   22 |         if(know){
      |            ^~~~
Catherine.cpp:32:17: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
   32 |                 seq.push_back(i);
      |                 ^~~
      |                 __pstl::execution::v1::seq
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Catherine.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:110:28: note: '__pstl::execution::v1::seq' declared here
  110 | constexpr sequenced_policy seq{};
      |                            ^~~
Catherine.cpp:35:12: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
   35 |         if(seq.size()==5){
      |            ^~~
      |            __pstl::execution::v1::seq
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Catherine.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:110:28: note: '__pstl::execution::v1::seq' declared here
  110 | constexpr sequenced_policy seq{};
      |                            ^~~
Catherine.cpp:52:13: error: 'know' was not declared in this scope
   52 |             know=true;
      |             ^~~~
Catherine.cpp:59:14: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
   59 |         last=seq.back();
      |              ^~~
      |              __pstl::execution::v1::seq
In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Catherine.cpp:2:
/usr/include/c++/11/pstl/execution_defs.h:110:28: note: '__pstl::execution::v1::seq' declared here
  110 | constexpr sequenced_policy seq{};
      |                            ^~~
Catherine.cpp:72:9: error: 'know' was not declared in this scope
   72 |         know=true;
      |         ^~~~