Submission #921602

# Submission time Handle Problem Language Result Execution time Memory
921602 2024-02-04T07:50:45 Z vjudge1 Council (JOI23_council) C++17
0 / 100
0 ms 348 KB
#pragma GCC optimize("unroll-loops")
#pragma gcc optimize("Ofast")
#pragma GCC optimization("Ofast")
#pragma optimize(Ofast)
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define str string
#define fastio ios::sync_with_stdio(0), cin.tie(0);
#define fs first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define len(x) x.size()

#define print(a)          \
    for (auto &x : a)     \
        cout << x << " "; \
    cout << endl;

#define printmp(a)    \
    for (auto &x : a) \
        cout << x.fs << " " << x.ss << endl;

const int mod = 998244353;

void solve()
{
    int n, m;
    cin >> n >> m;
    set<vector<int>> p;
    for(int i = 0; i < n; i ++){
        vector<int> b(m);
        for(int j = 0; j < m; j ++)
            cin >> b[j];
        p.insert(b);
    }
    n = p.size();
    vector<vector<int>> a;
    for(auto x : p)
        a.push_back(x);
    vector<int> cnt(m);
    for(int i = 0; i < n; i ++)
        for(int j = 0; j < m; j ++)
            cnt[j] += a[i][j];
    for(int i = 0; i < n; i ++){
        vector<int> important;
        int res = 0;
        for(int j = 0; j < m; j ++){
            cnt[j] -= a[i][j];
            if(cnt[j] == n / 2)
                important.push_back(j);
            if(cnt[j] >= n / 2)
                res ++;
        }
        int mn = res;
        for(int j = 0; j < n; j ++){
            if(i != j){
                int k = 0;
                for(auto x : important)
                    k += a[j][x];
                mn = min(mn, k);
            }
        }
        cout << res - mn << " ";
        for(int j = 0; j < m; j ++)
            cnt[j] += a[i][j];
    }
}

signed main()
{
    fastio int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        // cout << endl;
    }
}

Compilation message

council.cpp:2: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    2 | #pragma gcc optimize("Ofast")
      | 
council.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization("Ofast")
      | 
council.cpp:4: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    4 | #pragma optimize(Ofast)
      |
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -