Submission #1107561

# Submission time Handle Problem Language Result Execution time Memory
1107561 2024-11-01T13:30:14 Z 8pete8 Stray Cat (JOI20_stray) C++17
15 / 100
48 ms 19556 KB
#include "Anthony.h"
#include <vector>
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
using namespace std;
namespace {

int FunctionExample(int i, int A) {
  return i % A;
}

}  // namespace

vector<int> Mark(int n,int m, int a, int b,vector<int> U,vector<int> V) {
  vector<int> X(m);
  vector<int>lvl(n+1,1e9),vis(n,0);
  vector<vector<pii>>adj(n);
  for(int i=0;i<m;i++){
    adj[U[i]].pb({V[i],i}),adj[V[i]].pb({U[i],i});
  }
  queue<int>q;
  lvl[0]=0;
  q.push(0);
  while(!q.empty()){
    int cur=q.front();
    q.pop();
    if(vis[cur])continue;
    vis[cur]=1;
    for(auto i:adj[cur])if(!vis[i.f]&&lvl[i.f]>lvl[cur]+1){
      lvl[i.f]=lvl[cur]+1;
      q.push(i.f);
    }
  }
  if(a>=3){
    for(int i=0;i<n;i++)for(auto j:adj[i]){
      if(lvl[j.f]<lvl[i])X[j.s]=(lvl[j.f]%3);
      else X[j.s]=lvl[i]%3;
    }
  }
  else{
    //0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 1
    //1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0
    vector<int>pat={0,0,1,1,0,1};
    function<void(int,int)> dfs=[&](int cur,int p){
      for(auto i:adj[cur])if(i.f!=p){
        X[i.s]=pat[lvl[cur]%6];
        dfs(i.f,cur);
      }
    };
    dfs(0,-1);
  }
  return X;
}
#include "Catherine.h"
#include <vector>
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
using namespace std;
using namespace std;
namespace {

int a, b;
int variable_example = 0;
int found=0;
deque<int>cor={1,0,1,1,0,0};
vector<int>have;
}
void Init(int A, int B){
  ::a = A;
  ::b = B;
  found=0;
  have.clear();
}
int Move(vector<int> y){
  if(a>=3){
    int cnt=0;
    for(auto i:y)cnt+=!!i;
    if(cnt==0)assert(0);
    if(cnt==1){
      for(int i=0;i<y.size();i++)if(y[i])return i;
    }
    if(cnt==2){
      if(y[0]&&y[2])return 2;
      if(y[1]&&y[2])return 1;
      if(y[0]&&y[1])return 0;
    }
    assert(0);
  }
  else{
    if(have.size()<6&&!found){
      for(int i=0;i<y.size();i++)if(y[i]){
        have.pb(i);
        return i;
      }
      found=1;
      return -1;
    }
    else if(!found){
      int same=0;
      for(int i=0;i<6;i++){
        int yes=1;
        for(int j=0;j<6;j++)if(have[j]!=cor[j])yes=0;
        same|=yes;
        cor.push_back(cor.front());
        cor.pop_front();
      }
      found=1;
      if(!same)return -1;
    }
    for(int i=0;i<y.size();i++)if(y[i])return i;
  }
  assert(0);
  return -1;
}


Compilation message

Anthony.cpp:34:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   34 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
Anthony.cpp:38:33: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   38 | int FunctionExample(int i, int A) {
      |                                 ^
Anthony.cpp:44:71: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   44 | vector<int> Mark(int n,int m, int a, int b,vector<int> U,vector<int> V) {
      |                                                                       ^
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:74:50: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   74 |     function<void(int,int)> dfs=[&](int cur,int p){
      |                                                  ^
Anthony.cpp: At global scope:
Anthony.cpp:38:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
   38 | int FunctionExample(int i, int A) {
      |     ^~~~~~~~~~~~~~~

Catherine.cpp:34:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   34 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
Catherine.cpp:45:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   45 | void Init(int A, int B){
      |                       ^
Catherine.cpp:51:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   51 | int Move(vector<int> y){
      |                       ^
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:57:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |       for(int i=0;i<y.size();i++)if(y[i])return i;
      |                   ~^~~~~~~~~
Catherine.cpp:68:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |       for(int i=0;i<y.size();i++)if(y[i]){
      |                   ~^~~~~~~~~
Catherine.cpp:87:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 |     for(int i=0;i<y.size();i++)if(y[i])return i;
      |                 ~^~~~~~~~~
Catherine.cpp: At global scope:
Catherine.cpp:40:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   40 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 31 ms 15356 KB Output is correct
2 Correct 1 ms 936 KB Output is correct
3 Correct 26 ms 14684 KB Output is correct
4 Correct 35 ms 16428 KB Output is correct
5 Correct 43 ms 16188 KB Output is correct
6 Correct 28 ms 15200 KB Output is correct
7 Correct 32 ms 15296 KB Output is correct
8 Correct 38 ms 15808 KB Output is correct
9 Correct 37 ms 15968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 15356 KB Output is correct
2 Correct 1 ms 936 KB Output is correct
3 Correct 26 ms 14684 KB Output is correct
4 Correct 35 ms 16428 KB Output is correct
5 Correct 43 ms 16188 KB Output is correct
6 Correct 28 ms 15200 KB Output is correct
7 Correct 32 ms 15296 KB Output is correct
8 Correct 38 ms 15808 KB Output is correct
9 Correct 37 ms 15968 KB Output is correct
10 Correct 26 ms 13256 KB Output is correct
11 Correct 28 ms 13212 KB Output is correct
12 Correct 27 ms 13256 KB Output is correct
13 Correct 31 ms 13252 KB Output is correct
14 Correct 28 ms 13516 KB Output is correct
15 Correct 31 ms 13772 KB Output is correct
16 Correct 36 ms 15744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 12852 KB Output is correct
2 Correct 1 ms 764 KB Output is correct
3 Correct 26 ms 12264 KB Output is correct
4 Correct 48 ms 14156 KB Output is correct
5 Correct 37 ms 14196 KB Output is correct
6 Correct 34 ms 12844 KB Output is correct
7 Correct 36 ms 12892 KB Output is correct
8 Correct 33 ms 13668 KB Output is correct
9 Correct 32 ms 13620 KB Output is correct
10 Correct 31 ms 13404 KB Output is correct
11 Correct 32 ms 13584 KB Output is correct
12 Correct 36 ms 13328 KB Output is correct
13 Correct 33 ms 13404 KB Output is correct
14 Correct 37 ms 13680 KB Output is correct
15 Correct 34 ms 13628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 12852 KB Output is correct
2 Correct 1 ms 764 KB Output is correct
3 Correct 26 ms 12264 KB Output is correct
4 Correct 48 ms 14156 KB Output is correct
5 Correct 37 ms 14196 KB Output is correct
6 Correct 34 ms 12844 KB Output is correct
7 Correct 36 ms 12892 KB Output is correct
8 Correct 33 ms 13668 KB Output is correct
9 Correct 32 ms 13620 KB Output is correct
10 Correct 31 ms 13404 KB Output is correct
11 Correct 32 ms 13584 KB Output is correct
12 Correct 36 ms 13328 KB Output is correct
13 Correct 33 ms 13404 KB Output is correct
14 Correct 37 ms 13680 KB Output is correct
15 Correct 34 ms 13628 KB Output is correct
16 Correct 31 ms 11216 KB Output is correct
17 Correct 30 ms 11244 KB Output is correct
18 Correct 35 ms 11208 KB Output is correct
19 Correct 27 ms 11212 KB Output is correct
20 Correct 31 ms 11984 KB Output is correct
21 Correct 33 ms 11724 KB Output is correct
22 Correct 37 ms 13712 KB Output is correct
23 Correct 33 ms 11396 KB Output is correct
24 Correct 37 ms 11376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1280 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 19548 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 19556 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -