Submission #12112177


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

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

Submission Info

Submission Time
Task B - Homework
User hoget157
Language C++ (GCC 9.2.1)
Score 200
Code Size 1133 Byte
Status AC
Exec Time 8 ms
Memory 3620 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 3452 KB
hand_02 AC 2 ms 3520 KB
random_01 AC 8 ms 3432 KB
random_02 AC 3 ms 3620 KB
random_03 AC 3 ms 3592 KB
random_04 AC 3 ms 3404 KB
random_05 AC 2 ms 3552 KB
random_06 AC 2 ms 3444 KB
random_07 AC 2 ms 3444 KB
random_08 AC 4 ms 3568 KB
random_09 AC 5 ms 3440 KB
random_10 AC 5 ms 3408 KB
sample_01 AC 2 ms 3564 KB
sample_02 AC 1 ms 3520 KB
sample_03 AC 2 ms 3404 KB
sample_04 AC 2 ms 3564 KB