제출 #1302316

#제출 시각아이디문제언어결과실행 시간메모리
1302316tripadva삶의 질 (IOI10_quality)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
template <class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif



#define ar array
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int MAX_N = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
const char nl = '\n';
const long long int ll_MAX=9223372036854775807;
const string deb = "------------";
//[x,y],[a,b]
int stepenDvojke(int n) {
    int s = 1;
    while (s < n)
        s <<= 1;
    return s;
}
int a[3001][3001];
int A[3001][3001];
int h,w,N,M;

bool check(int k){
	memset(A, 0, sizeof(A));
	for(int i=1;i<=N;i++)
        for(int j=1;j<=M;j++)
            A[i][j] = (a[i-1][j-1] <= k ? 1 : -1);
	for(int i =1;i<=N;i++){
		for(int j = 1;j<=M;j++){
			A[i][j] = A[i][j] + A[i-1][j] + A[i][j-1] - A[i-1][j-1];

		}
	}
	for(int i =h;i<=N;i++){
		for(int j = w;j<=M;j++){
			if(A[i][j]-A[i-h][j]-A[i][j-w]+A[i-h][j-w]>=0)return true;
		}
	}
	return false;
	
	
	
}

int rectangle(int N,int M,int h,int w){
	for(int i =0;i<N;i++){
		for(int j = 0;j<M;j++)cin>>a[i][j];
	}
	
	int l = 1,r= N*M,rez = N*M;
	while(l<=r){
		int mid = (l+r)/2;
		
		if(check(mid))r=mid-1,rez=mid;
		else l=mid+1;
		
		
		
		
	}
	return rez;
}



void solve() {
	cin>>N>>M>>h>>w;
	rectangle(N,M,h,w);


}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
}

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

/usr/bin/ld: /tmp/cc9up4Bo.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQ4rVTB.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc9up4Bo.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status