Submission #826925

#TimeUsernameProblemLanguageResultExecution timeMemory
826925vjudge1Rectangles (IOI19_rect)C++17
10 / 100
6 ms340 KiB
#include <bits/stdc++.h>
#include "rect.h"
#define f first
#define s second 
#define ent '\n'
//#define int long long

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

//typedef long double ld;
typedef long long ll;
using namespace std;
 
struct node{double x,y;};
//double len(node a,node b)
//{return sqrt((a.x-b.x)*(a.x-b.y)+(a.y-b.y)*(a.x-b.y));}

struct seg{
	int m1,m2,sum,cnt;
};

const string out[2]={"No\n","Yes\n"};
const ll dx[]={0,0,1,-1,-1,1,1,-1};  
const ll dy[]={1,-1,0,0,-1,1,-1,1};
const int md=998244353;
const int mod=1e9+7;
const int mx=3e3+1; 
const int tst=1e5;
const bool T=0;

int a[mx][mx];
int n,m,k;

long long count_rectangles(vector<vector<int> > t){
	n=t.size();
	m=t[0].size();
	if(min(n,m)<3){
		return 0;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			a[i][j]=t[i-1][j-1];
		}
	}
	ll ans=0;
	if(n==3){
		for(int i=2;i<m;i++){
			int mx=0;
			for(int j=i;j<m;j++){
				if(a[2][j]>=min(a[1][j],a[3][j])){
					break;
				}
				mx=max(mx,a[2][j]);
				if(mx<min(a[2][i-1],a[2][j+1])){
					ans++;
				}
			}
		}
		return ans;
	}
}

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...