# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289864 |
2020-09-03T07:32:19 Z |
반딧불(#5785) |
Hamburg Steak (JOI20_hamburg) |
C++17 |
|
91 ms |
1912 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, k;
int l[100002], dd[100002], r[100002], u[100002];
int xMin = 0, xMax = 1e9, yMin = 0, yMax = 1e9;
int main(){
scanf("%d %d", &n, &k);
for(int i=1; i<=n; i++){
scanf("%d %d %d %d", &l[i], &dd[i], &r[i], &u[i]);
xMin = max(xMin, l[i]);
xMax = min(xMax, r[i]);
yMin = max(yMin, dd[i]);
yMax = min(yMax, u[i]);
}
if(k==1) printf("%d %d", xMin, yMin);
else{
vector<pair<int, int> > v {make_pair(xMin, yMin), make_pair(xMin, yMax), make_pair(xMax, yMin), make_pair(xMax, yMax)};
for(int d=0; d<16; d++){
if(__builtin_popcount(d) > k) continue;
int sum = 0;
for(int i=1; i<=n; i++){
for(int j=0; j<4; j++){
if(!(d&(1<<j))) continue;
if(l[i] <= v[j].first && v[j].first <= r[i] && dd[i] <= v[j].second && v[j].second <= u[i]){
sum++;
break;
}
}
}
if(sum == n){
int tmp = 0;
for(int i=0; i<4; i++){
if(!(d&(1<<i))) continue;
printf("%d %d\n", v[i].first, v[i].second);
tmp = i;
}
for(int i=__builtin_popcount(d); i<k; i++) printf("%d %d\n", v[tmp].first, v[tmp].second);
break;
}
}
}
}
Compilation message
hamburg.cpp: In function 'int main()':
hamburg.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
12 | scanf("%d %d", &n, &k);
| ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
14 | scanf("%d %d %d %d", &l[i], &dd[i], &r[i], &u[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Execution timed out |
75 ms |
1852 KB |
Time limit exceeded (wall clock) |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Execution timed out |
91 ms |
1912 KB |
Time limit exceeded (wall clock) |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |