# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1049979 |
2024-08-09T06:36:03 Z |
김은성(#11046) |
Hamburg Steak (JOI20_hamburg) |
C++17 |
|
1 ms |
2396 KB |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
int xg1[200009], yg1[200009], xg2[200009], yg2[200009];
tuple<int, int, int, int> solve(vector<int> vec){
int mnx2 = INF, mxx1 = 0, mny2 = INF, mxy1 = 0;
for(int i: vec){
mnx2 = min(mnx2, xg2[i]);
mxx1 = max(mxx1, xg1[i]);
mny2 = min(mny2, yg2[i]);
mxy1 = max(mxy1, yg1[i]);
}
return make_tuple(mnx2, mxx1, mny2, mxy1);
}
int main(){
int n, k, i;
scanf("%d %d", &n, &k);
vector<int> vec;
for(i=1; i<=n; i++){
scanf("%d %d", &xg1[i], &yg1[i]);
scanf("%d %d", &xg2[i], &yg2[i]);
vec.push_back(i);
}
auto [mnx2, mxx1, mny2, mxy1] = solve(vec);
if(mnx2 < mxx1){
vector<int> vec1, vec2;
for(i=1; i<=n; i++){
if(xg1[i] > mnx2){
vec2.push_back(i);
}
else{
vec1.push_back(i);
}
}
auto [tmnx2, tmxx1, tmny2, tmxy1] = solve(vec1);
auto [smnx2, smxx1, smny2, smxy1] = solve(vec2);
printf("%d %d\n", tmnx2, tmny2);
printf("%d %d\n", smnx2, smny2);
}
else if(mny2 < mxy1){
vector<int> vec1, vec2;
for(i=1; i<=n; i++){
if(yg1[i] > mny2){
vec2.push_back(i);
}
else{
vec1.push_back(i);
}
}
auto [tmnx2, tmxx1, tmny2, tmxy1] = solve(vec1);
auto [smnx2, smxx1, smny2, smxy1] = solve(vec2);
printf("%d %d\n", tmnx2, tmny2);
printf("%d %d\n", smnx2, smny2);
}
else{
printf("%d %d\n", mnx2, mny2);
printf("%d %d\n", mnx2, mny2);
}
return 0;
}
Compilation message
hamburg.cpp: In function 'int main()':
hamburg.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
17 | scanf("%d %d", &n, &k);
| ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
20 | scanf("%d %d", &xg1[i], &yg1[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
hamburg.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
21 | scanf("%d %d", &xg2[i], &yg2[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Extra information in the output file |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Extra information in the output file |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |