Submission #36694195
Source Code Expand
#include <iostream>
#include <vector>
#define int long long
using namespace std;
const int N=2e5+5;
int a[N];
int vis[N];
int s[N];
signed main()
{
int n;cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
int q;cin>>q;
int now=0,cnt=0;
while(q--)
{
int u;cin>>u;
if(u==1)
{
int x;cin>>x;
now=x;
cnt++;
}
else if(u==2)
{
int x,y;cin>>x>>y;
if(vis[x]!=cnt) vis[x]=cnt,s[x]=0;
s[x]+=y;
}
else
{
int x;cin>>x;
if(vis[x]!=cnt) vis[x]=cnt,s[x]=0;
if(!cnt) cout<<a[x]+s[x]<<endl;
else cout<<now+s[x]<<endl;
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - All Assign Point Add |
| User | gangbengr |
| Language | C++ (GCC 9.2.1) |
| Score | 400 |
| Code Size | 602 Byte |
| Status | AC |
| Exec Time | 314 ms |
| Memory | 8280 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| 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_N_small_03.txt, 01_N_small_04.txt, 01_N_small_05.txt, 01_N_small_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 03_max_11.txt, 04_handmade_12.txt, 04_handmade_13.txt, 04_handmade_14.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 11 ms | 3440 KiB |
| 00_sample_01.txt | AC | 2 ms | 3556 KiB |
| 00_sample_02.txt | AC | 2 ms | 3524 KiB |
| 01_N_small_03.txt | AC | 184 ms | 3472 KiB |
| 01_N_small_04.txt | AC | 106 ms | 3524 KiB |
| 01_N_small_05.txt | AC | 119 ms | 3528 KiB |
| 01_N_small_06.txt | AC | 301 ms | 3392 KiB |
| 02_random_07.txt | AC | 187 ms | 5888 KiB |
| 02_random_08.txt | AC | 144 ms | 7160 KiB |
| 02_random_09.txt | AC | 111 ms | 5828 KiB |
| 02_random_10.txt | AC | 314 ms | 6712 KiB |
| 03_max_11.txt | AC | 296 ms | 8028 KiB |
| 04_handmade_12.txt | AC | 267 ms | 4952 KiB |
| 04_handmade_13.txt | AC | 251 ms | 4568 KiB |
| 04_handmade_14.txt | AC | 289 ms | 8280 KiB |