結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 NachiaNachia
提出日時 2021-10-29 23:09:41
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,741 bytes
コンパイル時間 972 ms
コンパイル使用メモリ 92,576 KB
実行使用メモリ 163,488 KB
最終ジャッジ日時 2023-08-18 14:07:24
合計ジャッジ時間 54,565 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 10 ms
4,972 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 575 ms
38,088 KB
testcase_15 AC 1,898 ms
96,776 KB
testcase_16 TLE -
testcase_17 AC 1,809 ms
93,556 KB
testcase_18 AC 1,393 ms
76,192 KB
testcase_19 AC 2,388 ms
115,864 KB
testcase_20 AC 777 ms
43,696 KB
testcase_21 AC 2,188 ms
109,464 KB
testcase_22 AC 1,184 ms
59,080 KB
testcase_23 AC 1,103 ms
62,256 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 145 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)


struct Pos2{
  int x,y;
};

bool operator<(Pos2 l, Pos2 r){
  if(l.x != r.x) return l.x < r.x;
  return l.y < r.y;
}

Pos2 operator-(Pos2 l, Pos2 r){
  return { l.x - r.x, l.y - r.y };
}


int main(){
  int num_cup; cin >> num_cup;
  int num_ball; cin >> num_ball;
  vector<int> score_cup(num_cup);
  for(auto& a : score_cup) cin >> a;
  vector<Pos2> pos_cup(num_cup);
  for(auto& a : pos_cup) cin >> a.x >> a.y;
  vector<Pos2> pos_ball(num_ball);
  for(auto& a : pos_ball) cin >> a.x >> a.y;

  map<Pos2, int> score_table[2][2]; // reversed or not for x,y
  for(int cupi = 0; cupi < num_cup; cupi++){
    for(int balli = 0; balli < num_ball; balli++){
      for(int x_reversed : { 0, 1 }){
        for(int y_reversed : { 0, 1 }){
          //cout << x_reversed << ", " << y_reversed << ", "
          //<< (pos_ball[balli] - pos_cup[cupi]).x << ", "
          //<< (pos_ball[balli] - pos_cup[cupi]).y << " : " << score_cup[cupi] << endl;
          score_table[x_reversed][y_reversed][pos_ball[balli] - pos_cup[cupi]] += score_cup[cupi];
          pos_ball[balli].y *= -1;
        }
        pos_ball[balli].x *= -1;
      }
    }
  }

  int ans = 0;
  for(int x_reversed : { 0, 1 }){
    for(int y_reversed : { 0, 1 }){
      for(auto a : score_table[x_reversed][y_reversed]){
        ans = max(ans, a.second);
      }
    }
  }
  cout << ans << "\n";
  return 0;
}




struct ios_do_not_sync {
    ios_do_not_sync() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0