Submission #9806116


Source Code Expand

Copy
#include <iostream>
using namespace std;

int numberofrocks;

int main() {
 cin>>numberofrocks;
 int vals[numberofrocks];
 for (int i=0; i<numberofrocks;i++){
   cin>>vals[i];
 }
 int largest=0;
 for (int i=0;i<numberofrocks;i++){

   if (vals[i]>largest){
     largest= vals[i];
   }
 }
  
  int allpossible[largest];
  for (int i=0;i<largest;i++){
    allpossible[i]=i+1;
  }
  int sequence=1;
  int largestsub=0;
  for (int i=0;i<numberofrocks;i++){
    if (vals[i]==sequence){
      sequence+=1;
      largestsub+=1;
    }
  }
  cout<<largest-largestsub;
}

Submission Info

Submission Time
Task D - Brick Break
User nikkip
Language C++14 (GCC 5.4.1)
Score 0
Code Size 592 Byte
Status
Exec Time 85 ms
Memory 1792 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 400 sample_01, sample_02, sample_03, sample_04, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_2, testcase_20, testcase_21, testcase_3, testcase_4, testcase_5, testcase_6, testcase_7, testcase_8, testcase_9
Sample 0 / 0 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB
sample_04 1 ms 256 KB
testcase_0 28 ms 896 KB
testcase_1 59 ms 1408 KB
testcase_10 85 ms 1792 KB
testcase_11 78 ms 1792 KB
testcase_12 77 ms 1792 KB
testcase_13 76 ms 1792 KB
testcase_14 77 ms 1792 KB
testcase_15 78 ms 1792 KB
testcase_16 77 ms 1792 KB
testcase_17 75 ms 1792 KB
testcase_18 77 ms 1792 KB
testcase_19 75 ms 1792 KB
testcase_2 77 ms 1792 KB
testcase_20 79 ms 1792 KB
testcase_21 77 ms 1792 KB
testcase_3 60 ms 1536 KB
testcase_4 55 ms 1408 KB
testcase_5 76 ms 1792 KB
testcase_6 53 ms 1280 KB
testcase_7 10 ms 384 KB
testcase_8 77 ms 1792 KB
testcase_9 36 ms 1024 KB