# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725326 | quiet_space | Jakarta Skyscrapers (APIO15_skyscraper) | C++14 | 313 ms | 112204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define FOR(i,j,k) for(int i=j; i<=k; ++i)
#define ROF(i,j,k) for(int i=j; i>=k; --i)
inline int read (void) {
int x = 0, f = 1, ch = getchar();
while(!isdigit(ch)) { if(ch == '-') f = -f; ch = getchar(); }
while(isdigit(ch)) { x = x * 10 + ch - '0'; ch = getchar(); }
return x * f;
}
using tiii = std::tuple <int, int, int>;
const int maxn = 30005;
std::bitset <maxn> b[maxn];
std::vector <int> v[maxn];
std::queue <tiii> q;
int f[maxn];
int main (void) {
int n = read(), m = read(), pos0, pos1;
pos0 = read();
v[pos0].push_back (read());
pos1 = read();
v[pos1].push_back (read());
FOR(i,3,m) {
int x = read(), y = read();
v[x].push_back (y);
}
f[pos0] = 1;
for(auto&it:v[pos0]) q.emplace (pos0, it, 1);
while(!f[pos1] && !q.empty()) {
int x, y, z; std::tie (x, y, z) = q.front(); q.pop();
if(x + y < n && !b[x + y].test (y)) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |