結果

問題 No.1726 [Cherry 3rd Tune B] ジャマイカビアポン
ユーザー 👑 NachiaNachia
提出日時 2023-08-23 20:56:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,945 ms / 3,000 ms
コード長 1,615 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 97,972 KB
実行使用メモリ 105,252 KB
最終ジャッジ日時 2023-08-23 20:56:53
合計ジャッジ時間 30,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 237 ms
25,808 KB
testcase_15 AC 1,181 ms
71,988 KB
testcase_16 AC 1,499 ms
88,704 KB
testcase_17 AC 1,157 ms
72,740 KB
testcase_18 AC 802 ms
50,284 KB
testcase_19 AC 1,415 ms
81,616 KB
testcase_20 AC 351 ms
28,648 KB
testcase_21 AC 1,320 ms
78,296 KB
testcase_22 AC 593 ms
41,964 KB
testcase_23 AC 597 ms
43,304 KB
testcase_24 AC 1,906 ms
104,464 KB
testcase_25 AC 1,941 ms
105,220 KB
testcase_26 AC 1,890 ms
105,216 KB
testcase_27 AC 1,878 ms
105,252 KB
testcase_28 AC 1,902 ms
104,832 KB
testcase_29 AC 1,861 ms
104,620 KB
testcase_30 AC 1,828 ms
105,180 KB
testcase_31 AC 1,848 ms
104,776 KB
testcase_32 AC 1,945 ms
104,772 KB
testcase_33 AC 1,928 ms
103,996 KB
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 42 ms
4,380 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