fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define _ ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
  4. using namespace std;
  5.  
  6. int main() { _
  7. #ifndef ONLINE_JUDGE
  8. freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);
  9. #endif
  10. ll n, m; cin >> n >> m;
  11. vector <pair <ll, ll>> vec(n);
  12. for(int i = 0; i < n; i++){
  13. cin >> vec[i].first >> vec[i].second;
  14. }
  15. long double sum = 0.0;
  16. for(int i = 0; i < n; i++){
  17. sum += 1.0 * vec[i].first * vec[i].second / 100;
  18. if(sum > m){
  19. cout << i + 1 << endl;
  20. return 0;
  21. }
  22. }
  23. cout << -1 << endl;
  24. }
Runtime error #stdin #stdout #stderr 0s 4976KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc