/*************************************
* author: marvinthang *
* created: 30.12.2023 10:47:39 *
*************************************/
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
#include "debug.h"
#else
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define DB(...) 23
#define db(...) 23
#define debug(...) 23
#endif
template <class U, class V> scan_op(pair <U, V>) { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
// end of template
namespace {
int get_dir(int sr, int sc, int tr, int tc, int z) {
if (sc != tc) return sc < tc ? 0 : 1;
if (sr != tr) return sr < tr ? 2 : 3;
return 4;
}
}
void Anna(int N, int K, vector <int> R, vector <int> C) {
REP(x, N) REP(y, N) {
int cur = 0;
REPD(i, K) {
int dist = abs(x - R[i]) + abs(y - C[i]);
cur = cur * 3 + dist % 3;
}
SetFlag(x, y, cur);
}
}
/*************************************
* author: marvinthang *
* created: 30.12.2023 11:08:47 *
*************************************/
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
#include "debug.h"
#else
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define DB(...) 23
#define db(...) 23
#define debug(...) 23
#endif
template <class U, class V> scan_op(pair <U, V>) { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
// end of template
namespace {
}
vector <int> Bruno(int K, vector <int> value) {
vector <int> res(K, 4);
REP(i, K) {
int f = value[4] % 3;
int t = 0;
for (int d: {5, 3, 7, 1}) {
int v = value[d] % 3;
if ((v + 1) % 3 == f) {
res[i] = t;
break;
}
++t;
}
for (int &x: value) x /= 3;
}
return res;
}
Compilation message
Anna.cpp:48:6: warning: 'int {anonymous}::get_dir(int, int, int, int, int)' defined but not used [-Wunused-function]
48 | int get_dir(int sr, int sc, int tr, int tc, int z) {
| ^~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
8 ms |
664 KB |
Partially correct |
2 |
Partially correct |
8 ms |
664 KB |
Partially correct |
3 |
Partially correct |
7 ms |
920 KB |
Partially correct |
4 |
Partially correct |
8 ms |
920 KB |
Partially correct |
5 |
Partially correct |
8 ms |
920 KB |
Partially correct |
6 |
Partially correct |
7 ms |
920 KB |
Partially correct |
7 |
Partially correct |
9 ms |
920 KB |
Partially correct |
8 |
Partially correct |
11 ms |
920 KB |
Partially correct |
9 |
Partially correct |
8 ms |
664 KB |
Partially correct |
10 |
Partially correct |
7 ms |
1168 KB |
Partially correct |
11 |
Partially correct |
10 ms |
920 KB |
Partially correct |
12 |
Partially correct |
9 ms |
924 KB |
Partially correct |
13 |
Partially correct |
9 ms |
1176 KB |
Partially correct |
14 |
Partially correct |
8 ms |
920 KB |
Partially correct |
15 |
Partially correct |
8 ms |
664 KB |
Partially correct |
16 |
Partially correct |
7 ms |
664 KB |
Partially correct |
17 |
Partially correct |
7 ms |
920 KB |
Partially correct |
18 |
Partially correct |
9 ms |
920 KB |
Partially correct |
19 |
Partially correct |
9 ms |
920 KB |
Partially correct |
20 |
Partially correct |
8 ms |
664 KB |
Partially correct |
21 |
Partially correct |
8 ms |
920 KB |
Partially correct |
22 |
Partially correct |
9 ms |
920 KB |
Partially correct |
23 |
Partially correct |
7 ms |
920 KB |
Partially correct |
24 |
Partially correct |
7 ms |
664 KB |
Partially correct |
25 |
Partially correct |
7 ms |
664 KB |
Partially correct |
26 |
Partially correct |
10 ms |
664 KB |
Partially correct |
27 |
Partially correct |
7 ms |
920 KB |
Partially correct |
28 |
Partially correct |
7 ms |
920 KB |
Partially correct |
29 |
Partially correct |
8 ms |
664 KB |
Partially correct |
30 |
Partially correct |
7 ms |
664 KB |
Partially correct |
31 |
Partially correct |
8 ms |
920 KB |
Partially correct |
32 |
Partially correct |
8 ms |
664 KB |
Partially correct |
33 |
Partially correct |
7 ms |
744 KB |
Partially correct |
34 |
Partially correct |
9 ms |
920 KB |
Partially correct |
35 |
Partially correct |
7 ms |
664 KB |
Partially correct |
36 |
Partially correct |
7 ms |
920 KB |
Partially correct |
37 |
Partially correct |
7 ms |
920 KB |
Partially correct |
38 |
Partially correct |
9 ms |
1172 KB |
Partially correct |
39 |
Incorrect |
2 ms |
332 KB |
Wrong Answer [2] |
40 |
Halted |
0 ms |
0 KB |
- |