Submission #833524

# Submission time Handle Problem Language Result Execution time Memory
833524 2023-08-22T06:28:49 Z Trumling Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 2097152 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999

long long max_weights(int N, int M, vector<int> X, vector<int> Y,vector<int> W) 
{
  ll sum1=0,sum2=0;
  for(int i=0;i<M;i++)
  {
    if(X[i])
    sum1+=W[i];
    else
    sum2+=W[i];

  }
  if(N==2)
  return max(sum1,sum2);

  ll pre[2][N];
  ll maxi=max(sum1,sum2);
  vector<vector<int>>arr(N,vector<int>(N,0));
  for(int i=0;i<M;i++)
    arr[X[i]][Y[i]]=W[i];

  ll l=0,r=0;
  for(int i=0;i<N;i++)
  {
    l+=arr[0][i];
    r+=arr[1][i];
    maxi=max(maxi,l+sum1-r);
  }

  return maxi;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:26:6: warning: unused variable 'pre' [-Wunused-variable]
   26 |   ll pre[2][N];
      |      ^~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1172 ms 1827984 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 892 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 691 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Incorrect 1 ms 308 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Incorrect 1 ms 308 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 308 KB Output is correct
9 Incorrect 1 ms 308 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 691 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1172 ms 1827984 KB Time limit exceeded
2 Halted 0 ms 0 KB -