feat(codeforces): 10 more div 3s
This commit is contained in:
parent
dfa21f9de3
commit
70cc4b8436
24 changed files with 970 additions and 22 deletions
|
|
@ -39,35 +39,21 @@ constexpr T MAX = std::numeric_limits<T>::max();
|
|||
// }}}
|
||||
|
||||
void solve() {
|
||||
i32 n, H, M;
|
||||
i32 n, H, M, h, m;
|
||||
cin >> n >> H >> M;
|
||||
|
||||
pair<i32, i32> A{H,M};
|
||||
|
||||
vector<pair<i32, i32>> alarms(n);
|
||||
for (auto& e : alarms) {
|
||||
cin >> e.first >> e.second;
|
||||
}
|
||||
|
||||
sort(begin(alarms), end(alarms));
|
||||
|
||||
i32 ans = 0;
|
||||
i32 ans = 24 * 60;
|
||||
|
||||
for (i32 i = 0; i < n; ++i) {
|
||||
auto& alarm = alarms[i];
|
||||
if (alarm >= A) {
|
||||
ans = i;
|
||||
break;
|
||||
cin >> h >> m;
|
||||
i32 diff = h * 60 + m - (H * 60 + M);
|
||||
if (diff < 0) {
|
||||
diff += 24 * 60;
|
||||
}
|
||||
ans = min(ans, diff);
|
||||
}
|
||||
|
||||
auto& alarm = alarms[ans];
|
||||
i32 diff = abs(alarm.first * 60 + alarm.second - (A.first * 60 + A.second));
|
||||
if (alarm < A) {
|
||||
diff = 24 * 60 - diff;
|
||||
}
|
||||
|
||||
println("{} {}", diff / 60, diff % 60);
|
||||
println("{} {}", ans / 60, ans % 60);
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue