답안 #948290

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948290 2024-03-18T03:34:39 Z vjudge1 무지개나라 (APIO17_rainbow) C++17
11 / 100
3000 ms 22420 KB
//#include "rainbow.h"
#include <bits/stdc++.h>
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;
template<class S,class T>
bool chmin(S &a,const T &b) {
	return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
	return a<b?(a=b)==b:false;
}
const ll inf=1e18;
const ll mod=1e9+7;
const ll N=2e5+5;
const ld eps=1e-9;
bool vis[55][N];
bool f[55][N];
ll l,r,u,d;
ll xd[4]={-1,1,0,0},yd[4]={0,0,-1,1};
bool ok(ll x,ll y){
    return !vis[x][y] && !f[x][y] && x>=u && x<=d && y>=l && y<=r;
}
void bfs(ll x,ll y){
    ll i;
    vis[x][y]=1;
    for(i=0;i<4;i++){
        ll nx=x+xd[i],ny=y+yd[i];
        if(ok(nx,ny))bfs(nx,ny);
    }
}
void init(int r, int c, int sr, int sc, int m, char *s) {
    ll i,j;
    ll x=sr,y=sc;
    f[x][y]=1;
    for(i=0;i<m;i++){
        if(s[i]=='N')x--;
        if(s[i]=='S')x++;
        if(s[i]=='W')y--;
        if(s[i]=='E')y++;
        f[x][y]=1;
    }
}

int colour(int ar, int ac, int br, int bc) {
    u=ar,l=ac,d=br,r=bc;
    ll c=0,i,j;
    for(i=u;i<=d;i++){
        for(j=l;j<=r;j++){
            vis[i][j]=0;
        }
    }
    for(i=u;i<=d;i++){
        for(j=l;j<=r;j++){
            if(vis[i][j] || f[i][j]) continue;
            bfs(i,j);
            c++;
        }
    }
    return c;
}

Compilation message

rainbow.cpp:31:14: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   31 | const ll inf=1e18;
      |              ^~~~
rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:51:10: warning: unused variable 'j' [-Wunused-variable]
   51 |     ll i,j;
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 10584 KB Output is correct
2 Correct 6 ms 19004 KB Output is correct
3 Correct 10 ms 21128 KB Output is correct
4 Correct 11 ms 21056 KB Output is correct
5 Correct 6 ms 19032 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 10 ms 19288 KB Output is correct
12 Correct 9 ms 21072 KB Output is correct
13 Correct 7 ms 20828 KB Output is correct
14 Correct 5 ms 20828 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4536 KB Output is correct
3 Execution timed out 3062 ms 22420 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Runtime error 1 ms 856 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 10584 KB Output is correct
2 Correct 6 ms 19004 KB Output is correct
3 Correct 10 ms 21128 KB Output is correct
4 Correct 11 ms 21056 KB Output is correct
5 Correct 6 ms 19032 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 10 ms 19288 KB Output is correct
12 Correct 9 ms 21072 KB Output is correct
13 Correct 7 ms 20828 KB Output is correct
14 Correct 5 ms 20828 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4536 KB Output is correct
18 Runtime error 2 ms 860 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 10584 KB Output is correct
2 Correct 6 ms 19004 KB Output is correct
3 Correct 10 ms 21128 KB Output is correct
4 Correct 11 ms 21056 KB Output is correct
5 Correct 6 ms 19032 KB Output is correct
6 Correct 1 ms 4440 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 10 ms 19288 KB Output is correct
12 Correct 9 ms 21072 KB Output is correct
13 Correct 7 ms 20828 KB Output is correct
14 Correct 5 ms 20828 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4536 KB Output is correct
18 Runtime error 2 ms 860 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -