Submission #19621037


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define precision cout << fixed << setprecision(15);

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
clock_t time_p = clock();

void ktj() {
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre() {}

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}

template <typename A> string to_string(A);

template <typename A, typename B>string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A> string to_string(A v) {
  bool f = 1; string r = "{"; 
  for (const auto &x : v) { if (!f) r += ", "; f = 0; r += to_string(x); } 
  return r + "}";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { 
  cerr << " " << to_string(H); debug_out(T...); 
}

#ifdef LOCAL
  #define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
  #define pr(...) 42
#endif


void solve() {
  int n;
  long double x;
  cin >> n >> x;
  long double sum = 0;
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    long double v, p;
    cin >> v >> p;
    sum += (p * v) / 100.0;
    pr(sum, x);
    if (sum - x >= 1e-6) {
      if (ans == -1)
        ans = i;
    }
  }
  cout << ans << '\n';
}

#define GOOGLE 0
#define MULTIPLE_TC 0

int32_t main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL); 

  pre();

  int t = 1, T;

  if (MULTIPLE_TC)
    cin >> t;

  for (T = 1; T <= t; T++) {
    if (GOOGLE)
      cout << "Case #" << T << ": ";
    solve();
  }

  ktj();
}

Submission Info

Submission Time
Task B - Alcoholic
User kshitij_07
Language C++ (GCC 9.2.1)
Score 200
Code Size 2200 Byte
Status AC
Exec Time 8 ms
Memory 3840 KiB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:54:19: warning: statement has no effect [-Wunused-value]
   54 |   #define pr(...) 42
      |                   ^~
./Main.cpp:68:5: note: in expansion of macro ‘pr’
   68 |     pr(sum, x);
      |     ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, max_01.txt, max_02.txt, min_01.txt, min_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 7 ms 3780 KiB
hand_02.txt AC 2 ms 3840 KiB
hand_03.txt AC 2 ms 3700 KiB
hand_04.txt AC 2 ms 3780 KiB
hand_05.txt AC 2 ms 3796 KiB
hand_06.txt AC 2 ms 3804 KiB
max_01.txt AC 8 ms 3704 KiB
max_02.txt AC 7 ms 3768 KiB
min_01.txt AC 3 ms 3692 KiB
min_02.txt AC 2 ms 3768 KiB
random_01.txt AC 3 ms 3696 KiB
random_02.txt AC 3 ms 3684 KiB
random_03.txt AC 3 ms 3768 KiB
random_04.txt AC 3 ms 3688 KiB
random_05.txt AC 3 ms 3712 KiB
random_06.txt AC 4 ms 3784 KiB
random_07.txt AC 4 ms 3704 KiB
random_08.txt AC 4 ms 3696 KiB
random_09.txt AC 3 ms 3784 KiB
random_10.txt AC 3 ms 3700 KiB
random_11.txt AC 3 ms 3796 KiB
random_12.txt AC 2 ms 3704 KiB
random_13.txt AC 4 ms 3708 KiB
random_14.txt AC 3 ms 3684 KiB
random_15.txt AC 4 ms 3724 KiB
sample_01.txt AC 2 ms 3684 KiB
sample_02.txt AC 3 ms 3712 KiB
sample_03.txt AC 2 ms 3696 KiB