// countTreasure Report
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include "treasure.h"
// #include <bits/extc++.h>
using namespace std;
#define debug(pre) cout << #pre << " = " << pre << endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a, val) memset(a, val, sizeof (a))
#define PB push_back
#define endl '\n'
typedef long long ll;
inline int myrand(int l, int r) {
int ret = rand(); ret <<= 15; ret ^= rand();
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
return ret;
}
template <typename F, typename pre>
ostream& operator << (ostream& os, const pair< F, pre>& p) {
return os<<"(" <<p.first<<", "<<p.second<<")"; }
typedef pair<int, int> ii;
template<typename T> using min_pq =
std::priority_queue<T, vector<T>, greater<T> >;
//int dx[] = {-1, +0, +1, +0};
//int dy[] = {+0, +1, +0, -1};
const int maxn = 102;
int pre[maxn][maxn];
int countmy(int r1, int c1, int r2, int c2) {
return pre[r2][c2] - pre[r2][c1-1] - pre[r1-1][c2] + pre[r1-1][c1-1];
}
void findTreasure (int N) {
vector<ii> v;
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= N; j++) {
pre[i][j] = countTreasure(1, 1, i, j);
}
}
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= N; j++) {
if(countmy(i, j, i, j)) {
v.emplace_back(i, j);
}
}
}
for(ii &b : v) {
Report(b.first, b.second);
}
}
Compilation message
treasure.cpp: In function 'int myrand(int, int)':
treasure.cpp:20:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
^~
treasure.cpp:20:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
3 ms |
248 KB |
Output is partially correct - N = 5, K = 425, score = 8 |
2 |
Partially correct |
2 ms |
356 KB |
Output is partially correct - N = 10, K = 7075, score = 4 |
3 |
Partially correct |
3 ms |
524 KB |
Output is partially correct - N = 15, K = 36450, score = 4 |
4 |
Partially correct |
2 ms |
524 KB |
Output is partially correct - N = 16, K = 47296, score = 4 |
5 |
Partially correct |
2 ms |
648 KB |
Output is partially correct - N = 55, K = 6782050, score = 4 |
6 |
Partially correct |
3 ms |
696 KB |
Output is partially correct - N = 66, K = 14090571, score = 4 |
7 |
Partially correct |
3 ms |
720 KB |
Output is partially correct - N = 77, K = 26140961, score = 4 |
8 |
Partially correct |
3 ms |
720 KB |
Output is partially correct - N = 88, K = 44642224, score = 4 |
9 |
Partially correct |
3 ms |
720 KB |
Output is partially correct - N = 99, K = 71566902, score = 4 |
10 |
Partially correct |
4 ms |
720 KB |
Output is partially correct - N = 100, K = 74507500, score = 4 |