結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 NachiaNachia
提出日時 2023-08-23 20:55:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,613 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 97,956 KB
実行使用メモリ 102,060 KB
最終ジャッジ日時 2023-08-23 20:55:58
合計ジャッジ時間 25,410 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,990 ms
100,828 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 40 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_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;

  unordered_map<u64, 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 }){
          auto p = pos_ball[balli] - pos_cup[cupi];
          score_table[x_reversed][y_reversed][(u64)p.x << 32 | ((u64)p.y + 1ull << 31)] += 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