QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#872543#8623. Metaucup-team3099#AC ✓1ms3712kbC++204.0kb2025-01-26 02:18:592025-01-26 02:19:03

Judging History

你现在查看的是最新测评结果

  • [2025-01-26 02:19:03]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-26 02:18:59]
  • 提交

answer

#ifdef LOCAL
#define _GLIBCXX_DEBUG 1
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

#if 0
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
 
    template<class T>
    using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag,
        __gnu_pbds::tree_order_statistics_node_update>;
#endif

#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <queue>
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <ctime> 
#include <cstring>
#include <random>
#include <chrono>
#include <cassert>

using namespace std;
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

#define each(a,x) for (auto& a: x)
#define tcT template<class T
#define tcTU tcT, class U
#define tcTUU tcT, class ...U
template<class T> using V = vector<T>; 
template<class T, size_t SZ> using AR = array<T,SZ>;

typedef string str;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
 
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
 
mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count());
 
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(vector<bool> v) { str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);	res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) { str res = ""; F0R(i,SZ) res += char('0'+b[i]); return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { bool fst = 1; str res = "{"; for (const auto& x: v) {if (!fst) res += ", ";	fst = 0; res += ts(x);}	res += "}"; return res;}
template<class A, class B> str ts(pair<A,B> p) {return "("+ts(p.first)+", "+ts(p.second)+")"; }
 
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) { pr(h); pr(t...); }
void ps() { pr("\n"); }
template<class H, class... T> void ps(const H& h, const T&... t) { pr(h); if (sizeof...(t)) pr(" "); ps(t...); }
 
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {cerr << ts(h); if (sizeof...(t)) cerr << ", ";	DBG(t...); }

tcTU> void re(pair<T,U>& p);
tcT> void re(V<T>& v);
tcT, size_t SZ> void re(AR<T,SZ>& a);

tcT> void re(T& x) { cin >> x; }
void re(double& d) { str t; re(t); d = stod(t); }
void re(long double& d) { str t; re(t); d = stold(t); }
tcTUU> void re(T& t, U&... u) { re(t); re(u...); }

tcTU> void re(pair<T,U>& p) { re(p.first,p.second); }
tcT> void re(V<T>& x) { each(a,x) re(a); }
tcT, size_t SZ> void re(AR<T,SZ>& x) { each(a,x) re(a); }
tcT> void rv(int n, V<T>& x) { x.rsz(n); re(x); }

constexpr bool multitest() {return 0;}
void solve();
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t = 1;
	if (multitest()) cin >> t;
	for (; t; t--) solve();
}
























void solve() {
	int n; re(n);
	
	vi t;

	for (int i = 0; i < n; i++) {
		string s; int a,b,c; re(s,a,b,c);
		if (a==-1) a = 301;
		if (b==-1) b = 301;
		if (c==-1) c = 301;
		t.push_back(min({a,b,c}));
	}

	sort(all(t));
	int k = 300;
	int ans = 0;
	dbg(t);
	for (int i = 0; i < n; i++) {
		if (t[i] <= k) {
			k -= t[i];
			ans++;
		}
	}
	ps(ans);
}


















































	







这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

13
AplusB -1 20 -1
TheBestWife 80 90 60
Cardinality 40 50 30
3D 40 -1 70
EqualStrings 25 15 20
FastTreeQueries 120 -1 40
GeoSharding 25 20 30
HaveYouSeenThisSubarray 80 90 60
InteractiveCasino 50 20 30
JigsawPuzzle 40 50 80
Knapsack -1 40 200
LondonUnderground -1 200 40
Meta 5 7 10

output:

10

result:

ok 1 number(s): "10"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

10
a 30 30 50
b 30 30 50
c 30 30 50
d 30 30 50
e 30 30 50
f 30 30 50
g 30 30 50
h 30 30 50
i 30 30 50
j 30 30 50

output:

10

result:

ok 1 number(s): "10"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

11
a 30 30 50
b 30 30 50
c 30 30 50
d 30 30 50
e 30 30 50
f 30 30 50
g 30 30 50
h 30 30 50
i 30 30 50
j 30 30 50
k 30 30 50

output:

10

result:

ok 1 number(s): "10"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

11
a 31 31 50
b 31 31 50
c 31 31 50
d 31 31 50
e 31 31 50
f 31 31 50
g 31 31 50
h 31 31 50
i 31 31 50
j 31 31 50
k 31 31 50

output:

9

result:

ok 1 number(s): "9"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1
a -1 -1 -1

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1
A 300 300 -1

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

12
A 116 -1 36
B 67 106 -1
C 116 -1 15
D -1 -1 91
E 90 74 13
F -1 -1 -1
G 72 18 -1
H 80 -1 128
I 96 148 -1
J -1 82 111
K 77 -1 103
L 58 148 173

output:

7

result:

ok 1 number(s): "7"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

8
A 142 148 147
B -1 -1 -1
C -1 -1 -1
D -1 -1 -1
E -1 98 39
F -1 -1 52
G -1 215 -1
H 220 -1 -1

output:

3

result:

ok 1 number(s): "3"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

4
A 42 -1 37
B -1 -1 15
C -1 36 35
D -1 47 -1

output:

4

result:

ok 1 number(s): "4"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

14
A -1 21 82
B -1 -1 -1
C 81 197 -1
D -1 -1 -1
E -1 -1 -1
F 208 -1 182
G 212 -1 152
H -1 -1 105
I -1 -1 148
J 6 -1 46
K -1 -1 -1
L 191 -1 -1
M -1 36 51
N 48 -1 34

output:

6

result:

ok 1 number(s): "6"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

6
A -1 -1 44
B -1 21 2
C -1 21 -1
D 48 33 -1
E 44 -1 -1
F 35 15 9

output:

6

result:

ok 1 number(s): "6"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

6
A 134 124 22
B 5 28 72
C 77 100 41
D 130 137 96
E 0 150 30
F -1 38 -1

output:

6

result:

ok 1 number(s): "6"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

12
A 36 22 129
B 30 -1 -1
C -1 169 -1
D 43 -1 175
E -1 106 96
F -1 80 103
G 213 -1 -1
H 130 -1 240
I -1 201 -1
J -1 -1 -1
K -1 -1 101
L 130 129 118

output:

5

result:

ok 1 number(s): "5"

Test #14:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

4
A 36 -1 29
B 20 -1 49
C 11 -1 77
D -1 76 74

output:

4

result:

ok 1 number(s): "4"

Test #15:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

14
A -1 68 212
B 207 -1 -1
C -1 -1 217
D -1 -1 204
E -1 79 -1
F 67 101 226
G -1 236 217
H -1 -1 72
I 191 55 149
J -1 150 -1
K 41 51 -1
L 152 -1 -1
M 166 -1 174
N -1 -1 38

output:

5

result:

ok 1 number(s): "5"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

13
A 27 -1 114
B -1 -1 -1
C 48 -1 210
D 137 169 58
E -1 -1 136
F 154 156 -1
G 102 68 79
H 242 -1 234
I 145 -1 -1
J 190 -1 -1
K 33 246 194
L -1 -1 159
M -1 165 111

output:

5

result:

ok 1 number(s): "5"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

9
A 71 96 93
B -1 -1 20
C -1 -1 -1
D 41 -1 -1
E 83 -1 3
F -1 -1 14
G -1 35 -1
H -1 -1 -1
I 70 -1 -1

output:

7

result:

ok 1 number(s): "7"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1
A 40 -1 81

output:

1

result:

ok 1 number(s): "1"

Test #19:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

7
A -1 -1 41
B 97 26 -1
C -1 49 92
D -1 69 -1
E 29 44 -1
F -1 -1 54
G 36 -1 50

output:

6

result:

ok 1 number(s): "6"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

7
A -1 142 53
B 93 54 37
C 95 79 -1
D -1 -1 -1
E -1 76 64
F 43 -1 -1
G -1 143 23

output:

6

result:

ok 1 number(s): "6"

Test #21:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

13
A -1 -1 76
B 272 -1 -1
C -1 73 148
D -1 224 231
E 143 -1 267
F 26 -1 182
G -1 84 -1
H 209 -1 260
I -1 -1 -1
J -1 182 145
K -1 -1 38
L -1 -1 -1
M 158 132 233

output:

5

result:

ok 1 number(s): "5"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

9
A 107 66 131
B -1 -1 39
C 113 6 94
D 92 34 119
E -1 -1 30
F 17 -1 -1
G 101 -1 -1
H -1 -1 60
I -1 -1 -1

output:

7

result:

ok 1 number(s): "7"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1
A 159 -1 140

output:

1

result:

ok 1 number(s): "1"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1
A -1 -1 28

output:

1

result:

ok 1 number(s): "1"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

7
A -1 148 33
B -1 80 2
C 18 -1 -1
D 87 -1 -1
E 150 88 41
F -1 53 99
G 118 153 81

output:

6

result:

ok 1 number(s): "6"

Test #26:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1
A -1 41 -1

output:

1

result:

ok 1 number(s): "1"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

11
A 1 152 -1
B -1 -1 -1
C -1 -1 50
D 61 -1 29
E 47 10 182
F -1 -1 24
G 134 -1 -1
H 28 99 69
I -1 -1 77
J 140 -1 -1
K -1 46 -1

output:

8

result:

ok 1 number(s): "8"

Test #28:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

3
A 24 -1 -1
B 2 -1 -1
C 23 -1 -1

output:

3

result:

ok 1 number(s): "3"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

13
A 61 39 -1
B 109 104 158
C -1 -1 97
D 22 80 -1
E -1 73 -1
F 3 123 -1
G -1 69 30
H -1 84 -1
I -1 124 152
J 92 -1 -1
K -1 -1 -1
L 157 -1 -1
M 86 109 -1

output:

6

result:

ok 1 number(s): "6"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

10
A -1 -1 -1
B 20 11 -1
C 19 -1 -1
D -1 -1 -1
E 17 -1 -1
F -1 11 27
G 4 -1 10
H -1 26 27
I 29 19 -1
J 28 -1 17

output:

8

result:

ok 1 number(s): "8"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

2
A -1 71 -1
B -1 43 150

output:

2

result:

ok 1 number(s): "2"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

12
A -1 -1 -1
B -1 -1 32
C 68 211 93
D -1 -1 85
E 33 -1 64
F -1 111 198
G -1 13 -1
H 177 50 77
I 31 -1 -1
J 36 20 3
K 14 -1 197
L 60 51 31

output:

9

result:

ok 1 number(s): "9"

Test #33:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

8
A 22 -1 -1
B -1 -1 -1
C -1 21 -1
D -1 11 28
E -1 14 61
F 62 49 -1
G 39 24 -1
H 18 6 60

output:

7

result:

ok 1 number(s): "7"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

4
A 168 143 -1
B -1 -1 136
C 116 67 105
D 41 10 47

output:

3

result:

ok 1 number(s): "3"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10
A -1 -1 -1
B 27 51 -1
C -1 -1 -1
D 27 -1 11
E -1 28 -1
F 34 -1 -1
G -1 -1 43
H -1 16 7
I -1 43 -1
J -1 -1 19

output:

8

result:

ok 1 number(s): "8"

Test #36:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

12
A -1 30 -1
B -1 108 -1
C -1 70 82
D -1 31 65
E 79 120 -1
F 117 79 14
G -1 -1 31
H 114 -1 -1
I 113 11 -1
J -1 25 85
K -1 44 70
L -1 29 123

output:

9

result:

ok 1 number(s): "9"

Extra Test:

score: 0
Extra Test Passed