Codeforces Beta Round #53 B. Martian Architecture
Chrisが興味を持っている場所だけ調べる。PythonだとTLE。
#include <iostream> #include <vector> using namespace std; int main() { int n,m,k; cin >> n >> m >> k; vector<int> a(m), b(m), c(m); for ( int i=0; i<m; i++ ) cin >> a[i] >> b[i] >> c[i]; long long ans = 0; for ( int i=0; i<k; i++ ) { int t; cin >> t; for ( int j=0; j<m; j++ ) if ( a[j] <= t && t <= b[j] ) ans += c[j]+t-a[j]; } cout << ans << endl; }