#include <bits/stdc++.h>
#pragma optimize("03")
#pragma target("avx2")
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
const int MAX=55;
const int B=224;
const int N=1e6;
const int block=450;
const int maxB=MAX/B+10;
const ll inf=1e18;
const int mod=1e9+7;
const int mod1=1e9+9;
const int logg=15;
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
int binpow(int a,int n){
if(!n)return 1;
if(n%2==1)return a*binpow(a,n-1)%mod;
int k=binpow(a,n/2);
return k*k%mod;
}
int a[MAX][MAX];
int r,c;
void init(int R, int C, int sr, int sc, int M, char *s){
r=R;
c=C;
a[sr][sc]=1;
for(int i=0;i<M;i++){
if(s[i]=='N')sr--;
if(s[i]=='S')sr++;
if(s[i]=='W')sc--;
if(s[i]=='E')sc++;
a[sr][sc]=1;
}
}
bool inthe(int ar, int br, int ac, int bc,pii x){
return ar<=x.F&&x.F<=ac&&br<=x.S&&x.S<=bc;
}
int use[MAX][MAX];
void dfs(int ar, int br, int ac, int bc,int sr,int sc){
use[sr][sc]=1;
for(int i=0;i<4;i++){
int nx=sr+dx[i],ny=sc+dy[i];
if(!use[nx][ny]&&!a[nx][ny]&&inthe(ar,br,ac,bc,{nx,ny}))dfs(ar,br,ac, bc,nx,ny);
}
}
int colour(int ar, int br, int ac, int bc) {
mem(use,0);
int ans=0;
for(int i=1;i<=r;i++){
for(int j=1;j<=c;j++){
if(!use[i][j]&&!a[i][j]&&inthe(ar,br,ac,bc,{i,j})){
dfs(ar,br,ac,bc,i,j);
ans++;
}
}
}
return ans;
}
// int main(){
// int r,c,m,q;
// cin>>r>>c>>m>>q;
// int sr,sc;
// cin>>sr>>sc;
// char s[MAX];
// for(int i=0;i<m;i++)cin>>s[i];
// init(r,c,sr,sc,m,s);
// while(q--){
// int ar,br,ac,bc;
// cin>>ar>>br>>ac>>bc;
// cout<<colour(ar,br,ac,bc)<<"\n";
// }
// }
Compilation message
rainbow.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
3 | #pragma optimize("03")
|
rainbow.cpp:4: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
4 | #pragma target("avx2")
|
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
8 ms |
348 KB |
Output is correct |
3 |
Correct |
15 ms |
628 KB |
Output is correct |
4 |
Correct |
13 ms |
604 KB |
Output is correct |
5 |
Correct |
12 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
16 ms |
600 KB |
Output is correct |
12 |
Correct |
11 ms |
348 KB |
Output is correct |
13 |
Correct |
12 ms |
348 KB |
Output is correct |
14 |
Correct |
11 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
8 ms |
348 KB |
Output is correct |
3 |
Correct |
15 ms |
628 KB |
Output is correct |
4 |
Correct |
13 ms |
604 KB |
Output is correct |
5 |
Correct |
12 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
16 ms |
600 KB |
Output is correct |
12 |
Correct |
11 ms |
348 KB |
Output is correct |
13 |
Correct |
12 ms |
348 KB |
Output is correct |
14 |
Correct |
11 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
19 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
8 ms |
348 KB |
Output is correct |
3 |
Correct |
15 ms |
628 KB |
Output is correct |
4 |
Correct |
13 ms |
604 KB |
Output is correct |
5 |
Correct |
12 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
16 ms |
600 KB |
Output is correct |
12 |
Correct |
11 ms |
348 KB |
Output is correct |
13 |
Correct |
12 ms |
348 KB |
Output is correct |
14 |
Correct |
11 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
19 |
Halted |
0 ms |
0 KB |
- |