Submission #37491949


Source Code Expand

#include <bits/stdc++.h>

typedef  long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;
int main() {
    int N, Q;
    cin >> N ;
    vector<int> A(N),ans;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            int k, x;
            cin >> k >> x;
            A[k - 1] = x;
        }
        else if (t == 2) {
            int k;
            cin >> k;
            ans.push_back(A[k - 1]);
        }
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task B - First Query Problem
User amaoto
Language C++ (GCC 9.2.1)
Score 200
Code Size 705 Byte
Status AC
Exec Time 207 ms
Memory 4140 KiB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 11
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 6 ms 3584 KiB
00_sample_01.txt AC 2 ms 3544 KiB
00_sample_02.txt AC 2 ms 3584 KiB
01_random_03.txt AC 118 ms 3716 KiB
01_random_04.txt AC 148 ms 3984 KiB
01_random_05.txt AC 149 ms 3904 KiB
01_random_06.txt AC 45 ms 3560 KiB
01_random_07.txt AC 92 ms 3464 KiB
01_random_08.txt AC 207 ms 4140 KiB
01_random_09.txt AC 149 ms 3812 KiB
01_random_10.txt AC 151 ms 3808 KiB