Submission #287003

#TimeUsernameProblemLanguageResultExecution timeMemory
287003MasterTasterQuality Of Living (IOI10_quality)C++14
40 / 100
5052 ms2560 KiB
#include<bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include "quality.h"

using namespace std;

#define ll long long
#define pb push_back
#define pii pair<int, int>
#define xx first
#define yy second
#define endl "\n"

static int R,C,H,W,Q[3001][3001],i,j,ans;

pair<int, int> pos[90010];

int rectangle(int R, int C, int H, int W, int Q[3001][3001])
{
    int ress=R*C+1;

    int koji=H*W/2+1;
    for (int i=0; i<R; i++) for (int j=0; j<C; j++) pos[Q[i][j]]={i, j};

    for (int i=0; i<=R-H; i++)
    {
        for (int j=0; j<=C-W; j++)
        {
            int koliko=0;
            for (int k=1; k<=R*C; k++)
            {
                if (pos[k].xx>=i && pos[k].xx<i+H && pos[k].yy>=j && pos[k].yy<j+W) koliko++;
                if (koliko==koji)
                {
                    //cout<<i<<" "<<j<<" "<<k<<endl;
                    ress=min(ress, k);
                    break;
                }
            }

            /*vector<int> koji;
            for (int x=i; x<i+H; x++)
            {
                for (int y=j; y<j+W; y++)
                    koji.pb(Q[x][y]);
            }
            sort(koji.begin(), koji.end());

            //cout<<i<<" "<<j<<" "<<koji[koji.size()/2]<<endl;
            ress=min(ress, koji[koji.size()/2]);*/
        }
    }

    return ress;
	//return 1;
}

Compilation message (stderr)

quality.cpp:15:38: warning: 'ans' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                                      ^~~
quality.cpp:15:36: warning: 'j' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                                    ^
quality.cpp:15:34: warning: 'i' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                                  ^
quality.cpp:15:20: warning: 'Q' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                    ^
quality.cpp:15:18: warning: 'W' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                  ^
quality.cpp:15:16: warning: 'H' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |                ^
quality.cpp:15:14: warning: 'C' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |              ^
quality.cpp:15:12: warning: 'R' defined but not used [-Wunused-variable]
   15 | static int R,C,H,W,Q[3001][3001],i,j,ans;
      |            ^
#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...