Submission #60520877
Source Code Expand
Copy
// Problem: B - Humidifier 2// Contest: AtCoder - Daiwa Securities Co. Ltd. Programming Contest 2024(AtCoder Beginner Contest 383)// URL: https://atcoder.jp/contests/abc383/tasks/abc383_b// Memory Limit: 1024 MB// Time Limit: 2000 ms//// Powered by CP Editor (https://cpeditor.org)#include <bits/stdc++.h>#define int long long#define endl '\n'using namespace std;const int H=15;int h,w,d;string s[H];void solve(){cin>>h>>w>>d;for(int i=0;i<h;++i)cin>>s[i];vector<pair<int,int>> floor;for(int i=0;i<h;++i)
// Problem: B - Humidifier 2 // Contest: AtCoder - Daiwa Securities Co. Ltd. Programming Contest 2024(AtCoder Beginner Contest 383) // URL: https://atcoder.jp/contests/abc383/tasks/abc383_b // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int H=15; int h,w,d; string s[H]; void solve() { cin>>h>>w>>d; for(int i=0;i<h;++i)cin>>s[i]; vector<pair<int,int>> floor; for(int i=0;i<h;++i) for(int j=0;j<w;++j) if(s[i][j]=='.')floor.push_back({i,j}); int ans=0; for(int i=0;i<floor.size();++i) { for(int j=i+1;j<floor.size();++j) { int cnt=0; for(const auto& x:floor) { if(abs(floor[i].first-x.first)+abs(floor[i].second-x.second)<=d or abs(floor[j].first-x.first)+abs(floor[j].second-x.second)<=d) ++cnt; } ans=max(ans,cnt); } } cout<<ans<<endl; } signed main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int T=1;//cin>>T; while(T--)solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Humidifier 2 |
User | MountainRain |
Language | C++ 20 (gcc 12.2) |
Score | 250 |
Code Size | 1099 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 3624 KiB |
Compile Error
Main.cpp: In function ‘void solve()’: Main.cpp:25:22: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<std::pair<long long int, long long int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 25 | for(int i=0;i<floor.size();++i) | ~^~~~~~~~~~~~~ Main.cpp:27:32: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<std::pair<long long int, long long int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 27 | for(int j=i+1;j<floor.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 | 3492 KiB |
00_sample_01.txt | AC | 1 ms | 3496 KiB |
00_sample_02.txt | AC | 1 ms | 3508 KiB |
01_test_00.txt | AC | 1 ms | 3428 KiB |
01_test_01.txt | AC | 1 ms | 3508 KiB |
01_test_02.txt | AC | 1 ms | 3504 KiB |
01_test_03.txt | AC | 1 ms | 3436 KiB |
01_test_04.txt | AC | 1 ms | 3440 KiB |
01_test_05.txt | AC | 1 ms | 3508 KiB |
01_test_06.txt | AC | 1 ms | 3436 KiB |
01_test_07.txt | AC | 1 ms | 3488 KiB |
01_test_08.txt | AC | 1 ms | 3556 KiB |
01_test_09.txt | AC | 1 ms | 3360 KiB |
01_test_10.txt | AC | 1 ms | 3508 KiB |
01_test_11.txt | AC | 1 ms | 3428 KiB |
01_test_12.txt | AC | 1 ms | 3424 KiB |
01_test_13.txt | AC | 1 ms | 3576 KiB |
01_test_14.txt | AC | 1 ms | 3624 KiB |
01_test_15.txt | AC | 1 ms | 3504 KiB |
01_test_16.txt | AC | 1 ms | 3500 KiB |
01_test_17.txt | AC | 1 ms | 3556 KiB |
01_test_18.txt | AC | 1 ms | 3424 KiB |
01_test_19.txt | AC | 2 ms | 3492 KiB |
01_test_20.txt | AC | 2 ms | 3424 KiB |
01_test_21.txt | AC | 2 ms | 3508 KiB |
01_test_22.txt | AC | 1 ms | 3396 KiB |