Submission #54325123


Source Code Expand

Copy
#include<iostream>
using namespace std;
int main(){
int N,M,H[109];
cin>>N>>M;
for(int i=1;i<=N;i++) cin>>H[i];
for(int i=1;i<=N;i++){
M-=H[i];
if(M<0){
cout<<i-1<<endl;
return 0;
}
}
cout<<N<<endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<iostream>
using namespace std;
int main(){
  int N,M,H[109];
  cin>>N>>M;
  for(int i=1;i<=N;i++) cin>>H[i];
  for(int i=1;i<=N;i++){
    M-=H[i];
    if(M<0){
      cout<<i-1<<endl;
      return 0;
    }
  }
  cout<<N<<endl;
}

Submission Info

Submission Time
Task A - Sanitize Hands
User kei1231212
Language C++ 20 (gcc 12.2)
Score 100
Code Size 250 Byte
Status AC
Exec Time 1 ms
Memory 3668 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 19
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.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
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3480 KB
example_01.txt AC 1 ms 3400 KB
example_02.txt AC 1 ms 3524 KB
hand_00.txt AC 1 ms 3668 KB
hand_01.txt AC 1 ms 3520 KB
hand_02.txt AC 1 ms 3668 KB
hand_03.txt AC 1 ms 3468 KB
hand_04.txt AC 1 ms 3440 KB
hand_05.txt AC 1 ms 3524 KB
random_00.txt AC 1 ms 3668 KB
random_01.txt AC 1 ms 3500 KB
random_02.txt AC 1 ms 3468 KB
random_03.txt AC 1 ms 3524 KB
random_04.txt AC 1 ms 3400 KB
random_05.txt AC 1 ms 3528 KB
random_06.txt AC 1 ms 3444 KB
random_07.txt AC 1 ms 3404 KB
random_08.txt AC 1 ms 3480 KB
random_09.txt AC 1 ms 3604 KB


2025-04-03 (Thu)
20:26:19 +00:00