/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 324.0 KiB
#3 Wrong Answer 2ms 320.0 KiB

Code

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

int main(){
  int t;
  cin >> t;
  while (t--){
    ll n, S = 0;
    cin >> n;
    vector<vector<ll>> a(n, vector<ll> (3));
    for (int i = 0; i < n; i++) cin >> a[i][0];
    for (int i = 0; i < n; i++) cin >> a[i][1];
    for (int i = 0; i < n; i++) cin >> a[i][2];
    for (int i = 0; i < n; i++){
      sort(a[i].rbegin(), a[i].rend());
    }
    S += a[0][0];
    for (int i = 1; i < n; i++){
      if (a[i][0] == a[i - 1][0]){
        if (a[i][1] > a[i - 1][1]){
          S += a[i][1];
          a[i][0] = -1e18;
        } else {
          S += a[i - 1][1];
        }
      } else {
        S += a[i][0];
      }
    }
    cout << S << endl;
  }
}

Information

Submit By
Type
Submission
Problem
P1046 Maximum sum in 3-array
Contest
TLE_Headquarters - round #1
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-27 18:08:59
Judged At
2024-11-11 03:37:18
Judged By
Score
1
Total Time
2ms
Peak Memory
324.0 KiB