Submission #1079266

# Submission time Handle Problem Language Result Execution time Memory
1079266 2024-08-28T12:28:24 Z vjudge1 Catfish Farm (IOI22_fish) C++17
3 / 100
71 ms 14060 KB
#include "fish.h"

#include <bits/stdc++.h>

#define fore(i, l, r) for(int i=int(l); i<int(r); i++)

using namespace std;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
  long long ok=1,ok1=1;
    fore(i,0,M) {
        if(X[i] % 2)
            ok=0;
        if(X[i] > 1)
            ok1=0;
    }
    long long ans=0;
    if(ok)
      fore(i,0,M)
        ans+=W[i];
    else if(ok1) {
      long long grid[2][N+5];
      memset(grid,0,sizeof grid);
      fore(i,0,M)
        grid[X[i]][Y[i]] = W[i];
      long long sum1=0,sum2=0,temp1=0,temp2=0;
      fore(i,0,N) {
        sum1+=grid[0][i];
        sum2+=grid[1][i];
        if(sum1 >= sum2 and abs(sum1-sum2) >= abs(temp1-temp2)) {
          temp1=sum1;
          temp2=sum2;
        }
      }
      ans = sum2-temp2+temp1;
    } 
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3680 KB Output is correct
2 Correct 33 ms 4416 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 66 ms 13676 KB Output is correct
6 Correct 71 ms 14060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 29 ms 8284 KB Output is correct
3 Correct 37 ms 9948 KB Output is correct
4 Correct 15 ms 3552 KB Output is correct
5 Correct 21 ms 4424 KB Output is correct
6 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3680 KB Output is correct
2 Correct 33 ms 4416 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 66 ms 13676 KB Output is correct
6 Correct 71 ms 14060 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 29 ms 8284 KB Output is correct
9 Correct 37 ms 9948 KB Output is correct
10 Correct 15 ms 3552 KB Output is correct
11 Correct 21 ms 4424 KB Output is correct
12 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
13 Halted 0 ms 0 KB -