Created
December 11, 2016 13:47
-
-
Save tsuzu/e77343dbdeae22683169f83c6258343d to your computer and use it in GitHub Desktop.
JOI 2017 Yo 2nd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <vector> | |
#include <functional> | |
#include <queue> | |
#include <cmath> | |
#include <cstring> | |
int n, m; | |
int arr[1010]; | |
int main() { | |
std::cin >> n >> m; | |
int tmp; | |
for(int i = 0; i < m; ++i) { | |
std::cin >> arr[i] >> tmp; | |
} | |
std::sort(arr, arr + m, std::greater<int>()); | |
int ans = 0; | |
for(int i = 0; i < m - 1; ++i) { | |
ans += std::max(n - arr[i], 0); | |
} | |
std::cout << ans << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment