提出 #52892096


ソースコード 拡げる

#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int> sx[2],sy[2];
signed main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        int X,Y;
        cin >> X >> Y;
        int op = (X + Y) % 2;
        sx[op].push_back(X + Y);
        sy[op].push_back(X - Y);
    }
    auto work = [&](vector<int> a) -> int
    {
        sort(a.begin(),a.end());
        int ans = 0;
        for(int i = 1;i < a.size();i++)
        {
            ans += i * (a.size() - i) * (a[i] - a[i - 1]);
        }
        return ans;
    };
    int ans = 0;
    ans += work(sx[0]) + work(sx[1]) + work(sy[0]) + work(sy[1]);
    cout << ans / 2;
    return 0;
}

提出情報

提出日時
問題 E - Jump Distance Sum
ユーザ feather_life
言語 C++ 20 (gcc 12.2)
得点 500
コード長 710 Byte
結果 AC
実行時間 117 ms
メモリ 9640 KiB

コンパイルエラー

Main.cpp: In lambda function:
Main.cpp:21:25: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   21 |         for(int i = 1;i < a.size();i++)
      |                       ~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 2
AC × 27
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3484 KiB
example_01.txt AC 1 ms 3672 KiB
hand_00.txt AC 89 ms 9456 KiB
hand_01.txt AC 1 ms 3468 KiB
hand_02.txt AC 91 ms 9432 KiB
hand_03.txt AC 90 ms 9584 KiB
hand_04.txt AC 1 ms 3668 KiB
random_00.txt AC 114 ms 9596 KiB
random_01.txt AC 115 ms 9500 KiB
random_02.txt AC 113 ms 9380 KiB
random_03.txt AC 114 ms 9452 KiB
random_04.txt AC 113 ms 9596 KiB
random_05.txt AC 113 ms 9448 KiB
random_06.txt AC 113 ms 9352 KiB
random_07.txt AC 113 ms 9528 KiB
random_08.txt AC 114 ms 9436 KiB
random_09.txt AC 114 ms 9468 KiB
random_10.txt AC 114 ms 9640 KiB
random_11.txt AC 113 ms 9456 KiB
random_12.txt AC 113 ms 9408 KiB
random_13.txt AC 115 ms 9476 KiB
random_14.txt AC 114 ms 9352 KiB
random_15.txt AC 115 ms 9520 KiB
random_16.txt AC 117 ms 9444 KiB
random_17.txt AC 114 ms 9420 KiB
random_18.txt AC 115 ms 9392 KiB
random_19.txt AC 115 ms 9424 KiB