# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
773803 |
2023-07-05T08:46:04 Z |
vjudge1 |
Paint (COI20_paint) |
C++17 |
|
3000 ms |
1876 KB |
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define N 200005
int var[N],renk[N];
int n,m;
void bfs(int x,int co,int mor){
queue<int> q;
q.push(x);
while(q.size()){
int a=q.front();q.pop();
if(var[a])continue;
var[a]=1;
renk[a]=mor;
if((a-1)%m&&var[a-1]==0&&renk[a-1]==co){q.push(a-1);}
if(a%m&&var[a+1]==0&&renk[a+1]==co){q.push(a+1);}
if(a-m>0&&var[a-m]==0&&renk[a-m]==co){q.push(a-m);}
if(a+m<=n*m&&var[a+m]==0&&renk[a+m]==co){q.push(a+m);}
}
}
int main(){
lalala;
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int x=(i-1)*m+j;
cin>>renk[x];
}
}
int q;cin>>q;
while(q--){
int x,yyy,mor;cin>>x>>yyy>>mor;
x=(x-1)*m+yyy;
bfs(x,renk[x],mor);
memset(var,0,sizeof(var));
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int x=(i-1)*m+j;
cout<<renk[x];
}cout<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1164 ms |
1288 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3018 ms |
1876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
785 ms |
1788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |