제출 #1347822

#제출 시각아이디문제언어결과실행 시간메모리
1347822boropoto삶의 질 (IOI10_quality)C++20
0 / 100
1 ms344 KiB
#include<bits/stdc++.h>
#include "quality.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
int rectangle(int R, int C, int H, int W, int q[3001][3001])
{
    int r=R,c=C,h=H,w=W,k=r*c/2+1;
    int ans=1e18;
    for(int i=h-1;i<r;i++)
    {
        ordered_set<int> s;
        for(int a=i-h+1;a<=i;a++)
        {
            for(int b=w-1;b>=0;b--)
            {
                s.insert(q[a][b]);
            }
        }
        for(int j=w-1;j<c;j++)
        {
            auto it=s.find_by_order(k);
            ans=min(ans,*it);
            if(j==c-1)
            {
                break;
            }
            for(int z=i-h+1;z<i;z++)
            {
                s.erase(q[z][j-w+1]);
            }
            for(int z=i-h+1;z<i;z++)
            {
                s.insert(q[z][j+1]);
            }
        }
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:12:13: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   12 |     int ans=1e18;
      |             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...