Submission #12100167
Source Code Expand
Copy
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define pi 3.141592653589793238 #define int long long using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); #ifndef ONLINE_JUDGE if(fopen("INPUT.txt","r")) { freopen ("INPUT.txt" , "r" , stdin); freopen ("OUTPUT.txt" , "w" , stdout); } #endif // -------------------------------------Code starts here--------------------------------------------------------------------- int n,m; cin>>n>>m; int a[m]; int s=0; for (int i = 0; i < m; i++) { cin>>a[i]; s+=a[i]; } n-=s; if(n<0) cout<<-1; else cout<<n; // -------------------------------------Code ends here------------------------------------------------------------------ clock_t clk; clk = clock(); clk = clock() - clk; cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Homework |
User | babayaga |
Language | C++ (GCC 9.2.1) |
Score | 200 |
Code Size | 1206 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 3904 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | 2 ms | 3740 KB |
hand_02 | AC | 2 ms | 3800 KB |
random_01 | AC | 3 ms | 3748 KB |
random_02 | AC | 2 ms | 3752 KB |
random_03 | AC | 2 ms | 3788 KB |
random_04 | AC | 2 ms | 3736 KB |
random_05 | AC | 2 ms | 3744 KB |
random_06 | AC | 2 ms | 3764 KB |
random_07 | AC | 2 ms | 3660 KB |
random_08 | AC | 4 ms | 3856 KB |
random_09 | AC | 3 ms | 3904 KB |
random_10 | AC | 3 ms | 3748 KB |
sample_01 | AC | 2 ms | 3804 KB |
sample_02 | AC | 2 ms | 3656 KB |
sample_03 | AC | 2 ms | 3752 KB |
sample_04 | AC | 3 ms | 3792 KB |