提出 #19958544


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

#pragma GCC optimize("O3")

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n >> x;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<int> ans;
    for (int i = 0; i < n; i++)
    {
        if (a[i] != x)
            ans.push_back(a[i]);
    }
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << " ";
    }
    return 0;

}

提出情報

提出日時
問題 B - Remove It
ユーザ GrgaExe
言語 C++ (GCC 9.2.1)
得点 200
コード長 525 Byte
結果 AC
実行時間 28 ms
メモリ 4176 KiB

コンパイルエラー

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

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 14
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All handmade_00.txt, handmade_01.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, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
handmade_00.txt AC 6 ms 3616 KiB
handmade_01.txt AC 2 ms 3584 KiB
random_00.txt AC 17 ms 3960 KiB
random_01.txt AC 22 ms 4100 KiB
random_02.txt AC 28 ms 4108 KiB
random_03.txt AC 26 ms 4104 KiB
random_04.txt AC 26 ms 4092 KiB
random_05.txt AC 9 ms 3828 KiB
random_06.txt AC 13 ms 3828 KiB
random_07.txt AC 8 ms 3728 KiB
random_08.txt AC 15 ms 3776 KiB
random_09.txt AC 20 ms 4176 KiB
sample_01.txt AC 3 ms 3456 KiB
sample_02.txt AC 2 ms 3648 KiB