結果
| 問題 | No.5016 Worst Mayor | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-04-29 13:57:08 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 97 ms / 2,000 ms | 
| コード長 | 1,918 bytes | 
| コンパイル時間 | 1,664 ms | 
| コンパイル使用メモリ | 175,028 KB | 
| 実行使用メモリ | 24,372 KB | 
| スコア | 299,337,060 | 
| 平均クエリ数 | 400.00 | 
| 最終ジャッジ日時 | 2023-04-29 13:57:18 | 
| 合計ジャッジ時間 | 9,119 ms | 
| ジャッジサーバーID (参考情報) | judge13 / judge12 | 
| 純コード判定しない問題か言語 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 50 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n, t, x1, y1, x2, y2, u, v, cnt = 0, x, y;
    bool ok = false;
    long long map[27][27] = {0};
    vector<pair<long long, long long>> num;
    cin >> n >> t;
    vector<pair<long long, long long>> a, b;
    for (long long i = 0; i < n; i++)
    {
        cin >> x1 >> y1;
        a.push_back({x1, y1});
        cin >> x2 >> y2;
        b.push_back({x2, y2});
        if (x1 > x2)
        {
            swap(x1, x2);
        }
        if (y1 > y2)
        {
            swap(y1, y2);
        }
        for (long long p = 2 * x1 - 1; p < 2 * x2 - 2; p += 2)
        {
            for (long long q = 2 * y1 - 1; q < 2 * y2 - 2; q += 2)
            {
                map[p][q]++;
            }
        }
    }
    for (long long i = 1; i < 27; i += 2)
    {
        for (long long j = 1; j < 27; j += 2)
        {
            num.push_back({map[i][j], i + j});
        }
    }
    sort(num.begin(), num.end());
    for (long long i = 0; i < t; i++)
    {
        cin >> u >> v;
        if (i < 99)
        {
            cout << 2 << endl;
        }
        else if (i < 300)
        {
            if (u >= 1000000)
            {
                ok = true;
            }
            if (ok)
            {
                x = num[cnt].second % 27;
                y = num[cnt].second / 27;
                if (x % 2 == 1)
                {
                    cout << 1 << " " << x / 2 + 1 << " " << y / 2 + 1 << " " << x / 2 + 2 << " " << y / 2 + 1 << endl;
                }
                else
                {
                    cout << 1 << " " << x / 2 + 1 << " " << y / 2 + 1 << " " << x / 2 + 1 << " " << y / 2 + 2 << endl;
                }
            }
            else
            {
                cout << 3 << endl;
            }
        }
        else
        {
            cout << 3 << endl;
        }
        ok = false;
    }
}
            
            
            
        