QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#486102#6389. Topicalotarius0 7ms6052kbC++142.1kb2024-07-21 16:18:212024-07-21 16:18:21

Judging History

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

  • [2024-07-21 16:18:21]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:6052kb
  • [2024-07-21 16:18:21]
  • 提交

answer

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

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ull unsigned long long
#define all(x) (x).begin(),(x).end()

// #define int long long
// #define int unsigned long long

// #define ordered_set(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
// #define ordered_multiset(T) tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>

void open_file(string filename) {
    freopen((filename + ".in").c_str(), "r", stdin);
    freopen((filename + ".out").c_str(), "w", stdout);
}

// const ll mod = 1e9 + 7;
// const ll mod = 998244353;

const ll inf = 1e9;
const ll biginf = 1e18;
// const int maxN = 5 * 1e5 + 25;

void solve() {
    int n, m;
    cin >> n >> m;
    map<vector<int>, vector<int>> mp;
    int r[n + 1][m + 1], u[n + 1][m + 1];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> r[i][j];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> u[i][j];
    int ans = 0;
    set<vector<int>> st;
    for (int i = 1; i <= n; i++) {
        vector<int> tmp;
        for (int j = 1; j <= m; j++) tmp.pb(r[i][j]);
        st.insert(tmp); mp[tmp].pb(i);
    } vector<int> p(m, 0);
    for (int i = 1; i <= n; i++) {
        auto it = st.upper_bound(p);
        if (it == st.begin()) break;
        ans += mp[*it].size(); it--;
        for (int pos : mp[*it]) {
            for (int j = 1; j <= m; j++)
                p[j] += u[pos][j];
        } st.erase(it);
    } cout << ans;
}
int32_t main() { 
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        cout << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 12
Accepted
time: 0ms
memory: 3460kb

input:

1 1
693647287
340782526

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: -12
Runtime Error

input:

1 100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
279985824 991797187 998715443 98505529 106002744 636773096 815089164 196160830 796988849 87975...

output:


result:


Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 3624kb

input:

100 1
893339036
896783899
690308537
201770764
262364362
105000893
770698921
744238454
470980016
935046317
642998516
100481910
392307650
116783134
196939768
372329082
346372520
43063564
245523488
389084350
130314590
412588681
987795927
681635353
304582580
472268968
700147283
743357606
792644412
99955...

output:

1

result:

wrong answer 1st numbers differ - expected: '85', found: '1'

Subtask #3:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 7ms
memory: 6052kb

input:

10000 1
568857328
651788426
751475430
102940442
763289419
468657944
770847628
780257867
16919385
575963868
281824241
291248174
140016533
313529232
302186452
32709864
787073783
1926820
239509174
220454071
34252400
390385721
675239026
245106357
489697460
28435096
825528061
159083009
16370561
223299279...

output:

1

result:

wrong answer 1st numbers differ - expected: '10000', found: '1'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%