Submission #12137358


Source Code Expand

Copy
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n, m;
	cin>>n>>m;
	int s=0;
	for(int i=0; i<m; i++){
		int a; cin>>a;
		s+=a;
	}
	if(s>n) cout<<-1<<endl;
	else cout<<n-s<<endl;
	return 0;
}

Submission Info

Submission Time
Task B - Homework
User chocorusk
Language C++ (GCC 9.2.1)
Score 200
Code Size 745 Byte
Status AC
Exec Time 11 ms
Memory 3632 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 16
Set Name Test Cases
Sample sample_01, sample_02, sample_03, sample_04
All hand_01, hand_02, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
hand_01 AC 6 ms 3596 KB
hand_02 AC 4 ms 3520 KB
random_01 AC 7 ms 3520 KB
random_02 AC 4 ms 3592 KB
random_03 AC 3 ms 3588 KB
random_04 AC 3 ms 3596 KB
random_05 AC 2 ms 3452 KB
random_06 AC 2 ms 3624 KB
random_07 AC 2 ms 3564 KB
random_08 AC 6 ms 3548 KB
random_09 AC 4 ms 3436 KB
random_10 AC 11 ms 3632 KB
sample_01 AC 2 ms 3632 KB
sample_02 AC 2 ms 3592 KB
sample_03 AC 7 ms 3552 KB
sample_04 AC 2 ms 3524 KB