Submission #60511602
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int h,w,d;
int ax,ay,bx,by;
bool g[11][11];
int work(){
int res=0;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
if(!g[i][j])continue;
if(abs(i-ax)+abs(j-ay)<=d||abs(i-bx)+abs(j-by)<=d)res++;
}
}
return res;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>h>>w>>d;
vector<pair<int,int>> pp;
for(int i=1;i<=h;i++){
string s;
cin>>s;
for(int j=1;j<=w;j++){
if(s[j-1]=='#')g[i][j]=false;
else {g[i][j]=true;pp.push_back({i,j});}
}
}
int ans=0;
for(int i=0;i<pp.size();i++){
for(int j=i+1;j<pp.size();j++){
ax=pp[i].first,ay=pp[i].second;
bx=pp[j].first,by=pp[j].second;
ans=max(ans,work());
}
}
cout<<ans<<"\n";
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Humidifier 2 |
User |
Mint_Cat |
Language |
C++ 17 (gcc 12.2) |
Score |
250 |
Code Size |
822 Byte |
Status |
AC |
Exec Time |
2 ms |
Memory |
3648 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:38:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
38 | for(int i=0;i<pp.size();i++){
| ~^~~~~~~~~~
Main.cpp:39:32: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
39 | for(int j=i+1;j<pp.size();j++){
| ~^~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
250 / 250 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
3512 KB |
00_sample_01.txt |
AC |
1 ms |
3452 KB |
00_sample_02.txt |
AC |
1 ms |
3420 KB |
01_test_00.txt |
AC |
1 ms |
3648 KB |
01_test_01.txt |
AC |
1 ms |
3408 KB |
01_test_02.txt |
AC |
1 ms |
3532 KB |
01_test_03.txt |
AC |
1 ms |
3452 KB |
01_test_04.txt |
AC |
1 ms |
3524 KB |
01_test_05.txt |
AC |
1 ms |
3448 KB |
01_test_06.txt |
AC |
1 ms |
3400 KB |
01_test_07.txt |
AC |
1 ms |
3508 KB |
01_test_08.txt |
AC |
1 ms |
3536 KB |
01_test_09.txt |
AC |
1 ms |
3392 KB |
01_test_10.txt |
AC |
1 ms |
3532 KB |
01_test_11.txt |
AC |
1 ms |
3528 KB |
01_test_12.txt |
AC |
1 ms |
3376 KB |
01_test_13.txt |
AC |
1 ms |
3504 KB |
01_test_14.txt |
AC |
1 ms |
3512 KB |
01_test_15.txt |
AC |
1 ms |
3516 KB |
01_test_16.txt |
AC |
1 ms |
3452 KB |
01_test_17.txt |
AC |
1 ms |
3520 KB |
01_test_18.txt |
AC |
1 ms |
3524 KB |
01_test_19.txt |
AC |
2 ms |
3524 KB |
01_test_20.txt |
AC |
2 ms |
3532 KB |
01_test_21.txt |
AC |
2 ms |
3508 KB |
01_test_22.txt |
AC |
1 ms |
3524 KB |