제출 #422162

#제출 시각아이디문제언어결과실행 시간메모리
422162errorgornNavigation 2 (JOI21_navigation2)C++17
40 / 100
956 ms884 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ii pair<ll,ll> #define fi first #define se second #define puf push_front #define pof pop_front #define pub push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--) #define all(x) (x).begin(),(x).end() #define sz(x) (int) (x).size() namespace { int n,k; int grid[105][105]; } // namespace void Anna(int N, int K, std::vector<int> R, std::vector<int> C) { n=N,k=K; memset(grid,0,sizeof(grid)); rep(bit,0,k){ rep(x,0,n) rep(y,0,n){ if (y==C[bit]) grid[x][y]|=(1<<bit); if (x==R[bit] && y<=C[bit]+1) grid[x][y]|=(1<<bit); if (y<C[bit]){ if (x<R[bit] && ((R[bit]-x)%3==0 || (R[bit]-x)%3==2)) grid[x][y]|=(1<<bit); if (x>R[bit] && (x-R[bit])%3==0) grid[x][y]|=(1<<bit); } } } /* rep(x,0,n){ rep(y,0,n) cout<<(grid[x][y]&1)<<" "; cout<<endl; } //*/ rep(x,0,n) rep(y,0,n) SetFlag(x,y,grid[x][y]+1); }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ii pair<ll,ll> #define fi first #define se second #define puf push_front #define pof pop_front #define pub push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--) #define all(x) (x).begin(),(x).end() #define sz(x) (int) (x).size() namespace { int k; } // namespace std::vector<int> Bruno(int K, std::vector<int> value) { k=K; for (auto &it:value) it--; vector<int> ans; rep(bit,0,k){ vector<int> flip; rep(x,0,9){ if (value[x]&(1<<bit)) flip.pub(1); else flip.pub(0); } //for (auto &it:flip) cout<<it<<" "; cout<<endl; if (flip[1] && flip[4] && flip[7]){ if (flip[3] && flip[5]) ans.pub(4); else if (flip[0]+flip[3]+flip[6]==2) ans.pub(2); else ans.pub(3); } else if (!flip[2] && !flip[5] && !flip[8]) ans.pub(1); else ans.pub(0); } //for (auto &it:ans) cout<<it<<" "; cout<<endl; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...