| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363247 | yyc000123 | Subset Mex (EGOI22_subsetmex) | C++20 | 1 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int T = 205 ;
const int N = 55 ;
int t , n ;
ll arr[N] , brr[N] ;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) ;
cin >> t ;
while(t--){
cin >> n ;
memset(arr,0,sizeof(arr)) ;
memset(brr,0,sizeof(brr)) ;
for(int i=0 ; i<n ; i++) cin >> arr[i] ;
ll ans = 0 ; brr[n] = 1 ;
for(int i=n ; i>=0 ; i--){
if(brr[i]<=arr[i]) continue ;
ll diff = brr[i]-arr[i] ;
ans+=diff ;
for(int j=0 ; j<i ; j++) brr[j]+=diff ;
}
/*
while(!arr[n]){
for(int i=0 ; i<=n ; i++){
if(!arr[i]){
arr[i]++ ; break ;
}
arr[i]-- ;
}
ans++ ;
}
*/
cout << ans << '\n' ;
}
return 0 ;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
