답안 #1055957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055957 2024-08-13T06:49:01 Z pawned 메기 농장 (IOI22_fish) C++17
0 / 100
31 ms 18328 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;

#include "fish.h"

int MAX_R = 10;
int MAX_C = 10;

ll max_weights(int N, int M, vector<int> X_g, vector<int> Y_g, vector<int> W_g) {
	MAX_R = N;
	MAX_C = 3;
	vector<vi> a(MAX_R, vi(MAX_C, 0));
	for (int i = 0; i < M; i++) {
		if (X_g[i] < MAX_R && Y_g[i] < MAX_C)
			a[X_g[i]][Y_g[i]] += W_g[i];
	}
/*	cout<<"a: "<<endl;
	for (vi v : a) {
		for (ll x : v)
			cout<<x<<" ";
		cout<<endl;
	}*/
	vector<vi> pfs(MAX_R, vi(MAX_C + 1, 0));	// vertical pfs
	for (int i = 0; i < MAX_R; i++) {
		pfs[i][0] = 0;
		for (int j = 1; j <= MAX_C; j++) {
			pfs[i][j] = pfs[i][j - 1] + a[i][j - 1];
		}
	}
/*	cout<<"pfs: "<<endl;
	for (vi v : pfs) {
		for (ll x : v)
			cout<<x<<" ";
		cout<<endl;
	}*/
	if (N == 2) {
		return max(pfs[0][N], pfs[1][N]);
	}
	else {
		ll ans = 0;
		for (int i = 0; i <= N; i++) {
			ans = max(ans, (pfs[0][i] - pfs[0][0]) + (pfs[1][N] - pfs[1][i]));
		}
		return ans;
	}
}

// subtask 2: greedy
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 13404 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '1539084886'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 31 ms 18328 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '1494182325'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 12892 KB Output is correct
2 Incorrect 9 ms 12736 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 12892 KB Output is correct
2 Incorrect 9 ms 12736 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 13404 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '1539084886'
2 Halted 0 ms 0 KB -