QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#104183#5011. Course SelectionjoesmittyAC ✓11ms4244kbC++202.6kb2023-05-09 10:40:342023-05-09 10:40:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-09 10:40:37]
  • 评测
  • 测评结果:AC
  • 用时:11ms
  • 内存:4244kb
  • [2023-05-09 10:40:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
 
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
#define all(a) a.begin(), a.end()
#define endl '\n';
#define sz(x) (int)(x).size()
 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
 
template <typename T>
void pr(vector<T> &v) {
    FOR(i, 0, sz(v)) cout << v[i] << " ";
    cout << endl;
}
template <typename T>
void pr(vector<vector<T> > &v) {
    FOR(i, 0, sz(v)) { pr(v[i]); }
}
template <typename T>
void re(T &x) {
    cin >> x;
}
template <typename T>
void re(vector<T> &a) {
    FOR(i, 0, sz(a)) re(a[i]);
}
template <class Arg, class... Args>
void re(Arg &first, Args &... rest) {
    re(first);
    re(rest...);
}
template <typename T>
void pr(T x) {
    cout << x << endl;
}
template <class Arg, class... Args>
void pr(const Arg &first, const Args &... rest) {
    cout << first << " ";
    pr(rest...);
    cout << endl;
}
void ps() { cout << endl; }
template<class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
    cout << t; if (sizeof...(ts)) cout << " "; ps(ts...);
}
 
const ll MOD  =  1000000007;
#define inf 1e18;
#define INF INT_MAX;

long double PI = 4*atan(1);
long double eps = 1e-12;

vi ass[10005] = {};
int cap[10005] = {};
int main() {
    //auto start = chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);cin.tie(0);
    // freopen("promote.in", "r", stdin);
	// freopen("promote.out", "w", stdout);
    #ifdef DEBUG
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif 


    
    int n,s; cin >> n >> s;
    FOR(i,0,n) {
        cin >> cap[i];
    }

    int ans = 0;
    FOR(i,0,s) {
        FOR(j,0,5) {
            int d; cin >> d;
            d--;
            if(cap[d] > 0) {
                ans++;
                cap[d]--;
                ass[i].pb(d+1);
            }
        }
    }

    cout << ans << endl;
    FOR(i,0,s) {
        pr(ass[i]);
    }



    




    // auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
    // cout << duration.count() << endl;
    //cin.close();
    //cout.close();
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3816kb

input:

6 3
1
2
3
1
1
1
1 2 3 4 5
1 2 3 4 5
1 2 3 4 6

output:

9
1 2 3 4 5 
2 3 
3 6 

result:

ok All good..

Test #2:

score: 0
Accepted
time: 7ms
memory: 3848kb

input:

1000 10000
8
8
1
1
1
2
7
7
8
4
3
7
9
3
7
7
7
7
6
7
10
2
3
6
6
8
4
7
1
4
7
6
1
5
4
2
8
10
5
10
9
2
5
1
5
10
8
9
4
5
5
3
10
1
3
8
10
1
1
10
6
2
8
4
6
2
1
10
6
2
9
7
9
6
10
3
8
6
8
8
2
1
1
5
3
10
1
8
9
9
5
1
4
5
3
5
8
5
5
10
10
4
5
4
10
5
10
9
6
4
1
2
4
1
5
10
7
6
3
3
4
5
9
4
9
10
3
8
10
4
9
2
8
3
5
6
...

output:

5550
235 497 159 110 364 
710 991 945 80 215 
450 831 360 889 363 
607 154 937 118 150 
570 617 28 370 120 
735 613 462 856 529 
898 321 141 668 21 
130 445 4 856 375 
890 449 199 146 826 
541 737 502 232 231 
555 470 656 98 109 
983 326 407 58 370 
704 335 13 499 288 
657 359 76 731 178 
978 290 47...

result:

ok All good..

Test #3:

score: 0
Accepted
time: 9ms
memory: 4040kb

input:

1000 10000
15
14
32
65
28
96
33
93
48
28
57
20
32
20
90
42
57
53
18
58
94
21
27
29
37
22
94
45
67
60
83
23
20
23
35
93
3
42
6
46
68
46
34
25
17
16
50
5
49
91
23
76
69
100
58
68
81
32
88
41
64
29
37
13
95
25
6
59
74
58
31
35
16
80
13
80
10
59
85
18
16
70
51
40
44
28
8
76
8
87
53
86
28
100
2
73
14
100...

output:

37459
482 3 766 573 649 
112 143 710 525 390 
191 600 423 81 596 
576 456 888 573 639 
640 320 847 628 736 
535 395 121 177 482 
925 922 19 807 1 
167 844 196 916 13 
822 301 669 751 763 
583 105 484 209 627 
498 678 244 437 781 
572 900 886 869 169 
468 786 822 523 996 
443 730 109 512 820 
48 181 ...

result:

ok All good..

Test #4:

score: 0
Accepted
time: 11ms
memory: 4048kb

input:

1000 10000
894
197
325
232
902
183
41
481
495
266
152
704
790
458
546
258
30
366
747
546
332
816
523
683
771
152
647
967
785
793
62
915
864
667
972
536
678
183
290
164
533
374
932
943
508
627
226
823
644
596
767
620
563
613
53
340
813
164
591
752
990
342
326
157
97
25
197
373
732
224
693
539
826
835...

output:

48828
71 933 55 976 544 
593 334 527 640 17 
955 169 886 437 55 
652 500 215 380 721 
328 161 788 653 507 
441 195 137 469 924 
656 83 7 265 1000 
227 831 514 803 695 
704 830 61 559 399 
266 374 425 271 555 
27 102 518 381 899 
3 38 527 842 73 
173 29 577 798 861 
285 532 2 668 370 
219 683 933 837...

result:

ok All good..

Test #5:

score: 0
Accepted
time: 11ms
memory: 4244kb

input:

1000 10000
8581
6058
3019
2151
4140
4553
5920
9883
9170
318
1527
6945
5345
5007
6709
7960
7659
7507
7188
3939
4849
3336
7426
9064
4765
9262
9265
8162
8985
2298
9285
7280
9622
3652
3897
8691
4135
6185
682
2484
7107
8233
8426
9867
7526
314
574
2777
4928
5363
7617
9583
9748
8482
9103
1701
5339
951
4875...

output:

49909
873 732 30 69 650 
849 803 163 111 54 
724 528 77 374 727 
466 156 634 709 507 
77 687 581 123 922 
205 894 852 902 729 
384 677 377 699 388 
969 525 705 863 229 
444 387 532 973 335 
501 39 111 952 144 
482 606 809 720 571 
104 611 7 844 577 
233 969 794 822 378 
774 903 931 258 716 
289 278 ...

result:

ok All good..