# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
756067 | 2023-06-11T03:07:08 Z | yeyso | 메기 농장 (IOI22_fish) | C++17 | 49 ms | 15912 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; #include <vector> /* N - rows and columns M - number of fish X, Y - coordinates W - weights Y[i] = 0 means that we can only harvest up to 3 fish at a time */ long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { /*long long subtask1 = 1; long long subtask2 = 1; long long subtask3 = 1; long long res = 0; for(long long i = 0; i < W.size(); i ++){ if(X[i] % 2 == 0){ res += W[i]; } else { subtask1 = 0; } if(Y[i] > 1){ subtask2 = 0; } }*/ vector<vector<long long>> fish(M, vector<long long>()); for(long long i = 0; i < M; i ++){ fish[i] = {X[i], Y[i], W[i]}; } vector<long long> p(N, 0); for(long long i = 0; i < M; i ++){ p[X[i]] = W[i]; } vector<vector<long long>> dp(N+1, vector<long long>(3, 0)); dp[0][0] = 0; dp[0][1] = 0; dp[0][2] = p[0]; for(long long i = 1; i < p.size(); i ++){ dp[i][1] = dp[i-1][0]+p[i]; dp[i][2] = max(dp[i-1][0], dp[i-1][1])+p[i]; dp[i][0] = max(dp[i-1][0], max(dp[i-1][1], dp[i-1][2])); } /*for(long long i = 0; i < dp.size(); i ++){ cout << dp[i][0] << " "; }*/ return max(dp[N-1][1], dp[N-1][0]); //sort(fish.begin(), fish.end()); } /* g++ -std=gnu++17 -O2 -Wall -pipe -static -o fish grader.cpp fish.cpp 6 6 0 0 4 1 0 2 2 0 3 3 0 1 4 0 5 5 0 3 4 2 3 1 5 3 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 12236 KB | 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 1st lines differ - on the 1st token, expected: '2', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 6540 KB | Output is correct |
2 | Correct | 6 ms | 6444 KB | Output is correct |
3 | Correct | 25 ms | 10068 KB | Output is correct |
4 | Correct | 19 ms | 9936 KB | Output is correct |
5 | Correct | 49 ms | 15912 KB | Output is correct |
6 | Correct | 36 ms | 15252 KB | Output is correct |
7 | Correct | 39 ms | 15912 KB | Output is correct |
8 | Correct | 45 ms | 15912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '2' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 6540 KB | Output is correct |
2 | Correct | 6 ms | 6444 KB | Output is correct |
3 | Correct | 25 ms | 10068 KB | Output is correct |
4 | Correct | 19 ms | 9936 KB | Output is correct |
5 | Correct | 49 ms | 15912 KB | Output is correct |
6 | Correct | 36 ms | 15252 KB | Output is correct |
7 | Correct | 39 ms | 15912 KB | Output is correct |
8 | Correct | 45 ms | 15912 KB | Output is correct |
9 | Incorrect | 39 ms | 15672 KB | 1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 12236 KB | 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 | Halted | 0 ms | 0 KB | - |