Submission #250747

# Submission time Handle Problem Language Result Execution time Memory
250747 2020-07-19T03:56:14 Z balbit Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
4 ms 2688 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define f first
#define s second

#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...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT

#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define pb push_back

#ifndef BALBIT
#include "rainbow.h"
#endif

int n,m;
vector<pii> pts;

bool H(pii &p) {
    return *lower_bound(ALL(pts), p) == p;
}
const int maxn = 3e5+5;
bool g[2][maxn];
int ps[2][maxn];

void init(int R, int C, int sr, int sc, int M, char *S) {
    n = R, m = C;
    pts.pb({sr, sc});
    for (int i = 0; i<M; ++i) {
        if (S[i] == 'N') {
            --sr;
        }
        if (S[i] == 'S') {
            ++sr;
        }
        if (S[i] == 'E') {
            ++sc;
        }
        if (S[i] == 'W') {
            --sc;
        }
        g[sr-1][sc-1] = 1;
    }
    for (int j = 0; j<2; ++j) for (int i = 1; i<maxn; ++i) {
        ps[j][i] = ps[j][i-1] + (g[j][i]!=g[j][i-1]);
    }
//    sort(ALL(pts));
//    pts.resize(unique(ALL(pts)) - pts.begin());
}

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int r1, c1, r2, c2;


map<pii, int> dir;


int colour(int R1, int C1, int R2, int C2) {
    tie(r1,c1,r2,c2) = tie(R1,C1,R2,C2);
    -- r1; -- c1; --r2; --c2;
    if( r1 == r2) {
        int tmp = (ps[r1][c2] - ps[r1][c1]+1 + g[r1][c1] == 0)/2;
        return tmp;
    }else{
        int tmp = (ps[r1][c2] - ps[r1][c1])/2;
        if (tmp == 0) return g[r1][c1] == 0;
        else return tmp;
    }

    return 0;
}





#ifdef BALBIT
signed main(){
    IOS();

}
#endif
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -