include iostream include vector include string using namespace std int

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
while (n != 0)
{
string temp;
long long s1 = 0, s2 = 0;
int a1, a2, a = -1, b = 0;
for (int i = 0; i < n; i++)
{
do
{
cin >> temp;
} while (temp[temp.size() - 1] != ':');
cin >> a1 >> a2;
s1 += a1;
s2 += a2;
if (a < a1)
{
a = a1;
b = a2;
}
}
s2 += m - b;
if (s2 > s1)
cout << "Success" << endl;
else
cout << "Fail" << endl;
cin >> n >> m;
}
return 0;
}