Created
February 3, 2021 14:18
-
-
Save hotsuyuki/09c8b5cb3ba68cb638cc24f77f56f97e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define MAX_DRY_TIME 10001 | |
typedef unsigned long long ull; | |
using namespace std; | |
int main() { | |
ull num_rain, num_clothe, num_go; | |
cin >> num_rain; | |
cin >> num_clothe; | |
cin >> num_go; | |
ull prev_rain_time; | |
cin >> prev_rain_time; | |
ull max_rain_time_diff = 0; | |
for (ull i = 0; i < num_rain - 1; ++i) { | |
ull curr_rain_time; | |
cin >> curr_rain_time; | |
ull rain_time_diff = curr_rain_time - prev_rain_time; | |
if (max_rain_time_diff < rain_time_diff) { | |
max_rain_time_diff = rain_time_diff; | |
} | |
prev_rain_time = curr_rain_time; | |
} | |
vector<ull> dry_time_histogram(MAX_DRY_TIME, 0); | |
for (ull i = 0; i < num_clothe; ++i) { | |
ull dry_time; | |
cin >> dry_time; | |
dry_time_histogram[dry_time]++; | |
} | |
// cout << "dry_time_histogram = "; | |
// for (ull i = 0; i < MAX_DRY_TIME; ++i) { | |
// cout << dry_time_histogram[i] << " "; | |
// } | |
// cout << endl; | |
ull num_collect = 0; | |
ull min_dry_time = 1; | |
for (ull i = 1; i <= max_rain_time_diff; ++i) { | |
num_collect += dry_time_histogram[i]; | |
} | |
cout << num_collect << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment