# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472891 |
2021-09-14T12:56:26 Z |
AbdoMo |
Plahte (COCI17_plahte) |
C++17 |
|
2000 ms |
429944 KB |
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
const int mod = 1e9+7;
using namespace std;
bool comp(string a,string b)
{
if(a.size()==b.size())
{
return a<b;
}
return a.size()<b.size();
}
char mat[20][20];
bool vis[20][20];
bool f1(int i,int j)
{
char x=mat[i][j];
if(mat[i+1][j]==x && mat[i][j+1]==x && mat[i+1][j+1]==x)
{
if((vis[i+1][j]==0 && vis[i][j+1]==0 && vis[i+1][j+1]==0))
{
vis[i][j]=1;
vis[i+1][j]=1;
vis[i][j+1]=1;
vis[i+1][j+1]=1;
return 1;
}
}
return 0;
}
bool f2(int i,int j)
{
char x=mat[i][j];
if(mat[i+1][j]==x && mat[i+2][j]==x && mat[i+3][j]==x)
{
if((vis[i+1][j]==0 && vis[i+2][j]==0 && vis[i+3][j]==0))
{
vis[i][j]=1;
vis[i+1][j]=1;
vis[i+2][j]=1;
vis[i+3][j]=1;
return 1;
}
}
if(mat[i][j+1]==x && mat[i][j+2]==x && mat[i][j+3]==x)
{
if((vis[i][j+1]==0 && vis[i][j+2]==0 && vis[i][j+3]==0))
{
vis[i][j]=1;
vis[i][j+1]=1;
vis[i][j+2]=1;
vis[i][j+3]=1;
return 1;
}
}
return 0;
}
bool f3(int i,int j)
{
char x=mat[i][j];
if(mat[i+1][j]==x && mat[i][j-1]==x && mat[i-1][j-1]==x)
{
if((vis[i+1][j]==0 && vis[i][j-1]==0 && vis[i-1][j-1]==0))
{
vis[i][j]=1;
vis[i+1][j]=1;
vis[i][j-1]=1;
vis[i-1][j-1]=1;
return 1;
}
}
if(mat[i][j-1]==x && mat[i-1][j]==x && mat[i-1][j+1]==x)
{
if((vis[i][j-1]==0 && vis[i-1][j]==0 && vis[i-1][j+1]==0))
{
vis[i][j]=1;
vis[i][j-1]=1;
vis[i-1][j]=1;
vis[i-1][j+1]=1;
return 1;
}
}
return 0;
}
bool f4(int i,int j)
{
char x=mat[i][j];
if(mat[i+1][j]==x && mat[i][j+1]==x && mat[i-1][j+1]==x)
{
if((vis[i+1][j]==0 && vis[i][j+1]==0 && vis[i-1][j+1]==0))
{
vis[i][j]=1;
vis[i+1][j]=1;
vis[i][j+1]=1;
vis[i-1][j+1]=1;
return 1;
}
}
if(mat[i][j+1]==x && mat[i-1][j]==x && mat[i-1][j-1]==x)
{
if((vis[i][j+1]==0 && vis[i-1][j]==0 && vis[i-1][j-1]==0))
{
vis[i][j]=1;
vis[i][j+1]=1;
vis[i-1][j]=1;
vis[i-1][j-1]=1;
return 1;
}
}
return 0;
}
bool f5(int i,int j)
{
char x=mat[i][j];
if(mat[i][j+1]==x && mat[i][j-1]==x && mat[i-1][j]==x)
{
if((vis[i][j+1]==0 && vis[i][j-1]==0 && vis[i-1][j]==0))
{
vis[i][j]=1;
vis[i][j+1]=1;
vis[i][j-1]=1;
vis[i-1][j]=1;
return 1;
}
}
if(mat[i][j+1]==x && mat[i][j-1]==x && mat[i+1][j]==x)
{
if((vis[i][j+1]==0 && vis[i][j-1]==0 && vis[i+1][j]==0))
{
vis[i][j]=1;
vis[i][j+1]=1;
vis[i][j-1]=1;
vis[i+1][j]=1;
return 1;
}
}
if(mat[i][j-1]==x && mat[i-1][j]==x && mat[i+1][j]==x)
{
if((vis[i][j-1]==0 && vis[i-1][j]==0 && vis[i+1][j]==0))
{
vis[i][j]=1;
vis[i][j-1]=1;
vis[i-1][j]=1;
vis[i+1][j]=1;
return 1;
}
}
if(mat[i][j+1]==x && mat[i-1][j]==x && mat[i+1][j]==x)
{
if((vis[i][j+1]==0 && vis[i-1][j]==0 && vis[i+1][j]==0))
{
vis[i][j]=1;
vis[i][j+1]=1;
vis[i-1][j]=1;
vis[i+1][j]=1;
return 1;
}
}
return 0;
}
void solve(){
int n,m;
cin>>n>>m;
set<int>st[n];
int arr[n][4];
for(int i=0;i<n;i++)
{
for(int j=0;j<4;j++)
{
cin>>arr[i][j];
}
}
int pp[n][3];
for(int i=0;i<m;i++)
{
int x,y,z;
cin>>x>>y>>z;
for(int j=0;j<n;j++)
{
//cout<<arr[j][0]<<" "<<arr[j][2]<<" "<<arr[j][1]<<" "<<arr[j][3]<<endl;
if(x>=arr[j][0] && x<=arr[j][2] && y>=arr[j][1] && y<=arr[j][3])
{
//cout<<pp[i][2]<<endl;
st[j].insert(z);
}
}
}
for(int i=0;i<n;i++)
{
cout<<st[i].size()<<endl;
}
}
int32_t main(){
int t=1;
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//cin>>t;
while(t--){solve();}
return 0;
}
Compilation message
plahte.cpp: In function 'void solve()':
plahte.cpp:177:9: warning: unused variable 'pp' [-Wunused-variable]
177 | int pp[n][3];
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2085 ms |
147376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2087 ms |
288768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2099 ms |
414936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2105 ms |
429944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2106 ms |
361168 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |