Submission #575297

#TimeUsernameProblemLanguageResultExecution timeMemory
575297balbitNavigation 2 (JOI21_navigation2)C++17
75 / 100
733 ms996 KiB
#include "Anna.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define f first #define s second #define REP(i,n) for (int i = 0; i<n; ++i) #define REP1(i,n) for (int i = 1; i<=n; ++i) #define MX(a,b) a = max(a,b) #define MN(a,b) a = min(a,b) #define pb push_back #define SZ(x) (int)(x).size() #define ALL(x) (x).begin(), (x).end() #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do(T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #endif // BALBIT namespace { const int maxn = 505; int g[maxn][maxn]; int get(int r, int c, int tr, int tc) { if (max(abs(r - tr) , abs(c - tc) ) <= 1) { return (tr-r+1) * 3 + (tc - c+1) + 1; }else{ if (r < tr-1) return 10; // r++ if (r > tr+1) return 11; // r--; if (c < tc-1) return 12; // c++ if (c > tc+1) return 13; // c--; } } #ifdef BALBIT #endif // BALBIT } // namespace void Anna(int N, int K, vector<int> R, vector<int> C) { for (int r = 0; r < N; r++) { for (int c = 0; c < N; c++) { int id = (r % 3) * 3 + (c % 3); if (id < K) { SetFlag(r, c, get(r, c, R[id],C[id])); }else{ SetFlag(r, c, 14); } } } }
#include "Bruno.h" #include <vector> //#define BALBIT #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define f first #define s second #define REP(i,n) for (int i = 0; i<n; ++i) #define REP1(i,n) for (int i = 1; i<=n; ++i) #define MX(a,b) a = max(a,b) #define MN(a,b) a = min(a,b) #define pb push_back #define SZ(x) (int)(x).size() #define ALL(x) (x).begin(), (x).end() #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do(T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #endif // BALBIT namespace { const int maxn = 505; } std::vector<int> Bruno(int K, std::vector<int> value) { array<array<int, 5>, 5> tmp; REP(i,5) REP(j,5) { tmp[i][j] = (i % 3) * 3 + (j % 3); // bug(i,j,tmp[i][j]); } for (int ti = 1; ti <= 3; ++ti) for (int tj = 1; tj <= 3; ++tj) { // test it vector<int> re(K); bool ok = 1; int it = 0; for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) { if (value[it] == 14) { if (tmp[ti + di][tj + dj] < K) { ok = 0; goto nope; } } ++it; } bug(ti, tj); assert(ok); it = 0; for (int di = -1; di <= 1; ++di) for (int dj = -1; dj <= 1; ++dj) { int hi = value[it]; bug(it, hi); if (value[it] == 14) { ++it; continue; } int who = tmp[ti + di][tj + dj]; if (value[it] >= 10) { if (value[it] == 10) re[who] = 2; if (value[it] == 11) re[who] = 3; if (value[it] == 12) re[who] = 0; if (value[it] == 13) re[who] = 1; }else{ int ai = di + ((hi-1)/3-1); int aj = dj + ((hi-1)%3-1); if (ai == 0 && aj == 0) { re[who] = 4; }else{ bug("from here!"); if (0 < ai) re[who] = 2; if (0 > ai) re[who] = 3; if (0 < aj) re[who] = 0; if (0 > aj) re[who] = 1; } } bug(it, who, re[who]); ++it; } return re; nope:; } } /* 1 7 7 2 2 2 3 4 5 4 2 6 4 3 2 3 3 2 3 */

Compilation message (stderr)

Anna.cpp: In function 'int {anonymous}::get(int, int, int, int)':
Anna.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
Anna.cpp: At global scope:
Anna.cpp:35:5: warning: '{anonymous}::g' defined but not used [-Wunused-variable]
   35 | int g[maxn][maxn];
      |     ^

Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:100:1: warning: control reaches end of non-void function [-Wreturn-type]
  100 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...