Submission #1077502

# Submission time Handle Problem Language Result Execution time Memory
1077502 2024-08-27T07:43:48 Z vjudge1 Council (JOI23_council) C++17
6 / 100
4000 ms 8276 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=3e5+5,M=1030;
int a[N],n,m,f[20],b[M];
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	for (int i=1;i<=n;i++){
		for (int j=0;j<m;j++){
			bool x;cin>>x;
			if (x) a[i]|=(1<<j),f[j]++;
		}
		b[a[i]]++;
	}	
	for (int i=1;i<=n;i++){
		for (int j=0;j<m;j++) if (a[i]&(1<<j)) f[j]--;
		b[a[i]]--;
		int ans=0,x=0;
		for (int j=0;j<m;j++) x+=(f[j]>=n/2);
		for (int j=0;j<M;j++){
			if (!b[j]) continue;
			int y=x;
			for (int k=0;k<m;k++) if ((j&(1<<k)) && f[k]==n/2) y--;
			ans=max(ans,y);
		}
		for (int j=0;j<m;j++) if (a[i]&(1<<j)) f[j]++;
		b[a[i]]++;
		cout<<ans<<endl; 
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 268 ms 3364 KB Output is correct
3 Correct 243 ms 2108 KB Output is correct
4 Correct 244 ms 2908 KB Output is correct
5 Correct 251 ms 3152 KB Output is correct
6 Correct 238 ms 2772 KB Output is correct
7 Correct 274 ms 3156 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 3 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 268 ms 3364 KB Output is correct
3 Correct 243 ms 2108 KB Output is correct
4 Correct 244 ms 2908 KB Output is correct
5 Correct 251 ms 3152 KB Output is correct
6 Correct 238 ms 2772 KB Output is correct
7 Correct 274 ms 3156 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 3 ms 500 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 3482 ms 7972 KB Output is correct
21 Correct 1626 ms 7428 KB Output is correct
22 Correct 1598 ms 7252 KB Output is correct
23 Correct 392 ms 8276 KB Output is correct
24 Correct 371 ms 6828 KB Output is correct
25 Correct 3931 ms 7960 KB Output is correct
26 Execution timed out 4073 ms 7524 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 268 ms 3364 KB Output is correct
3 Correct 243 ms 2108 KB Output is correct
4 Correct 244 ms 2908 KB Output is correct
5 Correct 251 ms 3152 KB Output is correct
6 Correct 238 ms 2772 KB Output is correct
7 Correct 274 ms 3156 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 3 ms 500 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 3482 ms 7972 KB Output is correct
21 Correct 1626 ms 7428 KB Output is correct
22 Correct 1598 ms 7252 KB Output is correct
23 Correct 392 ms 8276 KB Output is correct
24 Correct 371 ms 6828 KB Output is correct
25 Correct 3931 ms 7960 KB Output is correct
26 Execution timed out 4073 ms 7524 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 268 ms 3364 KB Output is correct
3 Correct 243 ms 2108 KB Output is correct
4 Correct 244 ms 2908 KB Output is correct
5 Correct 251 ms 3152 KB Output is correct
6 Correct 238 ms 2772 KB Output is correct
7 Correct 274 ms 3156 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 3 ms 500 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 3482 ms 7972 KB Output is correct
21 Correct 1626 ms 7428 KB Output is correct
22 Correct 1598 ms 7252 KB Output is correct
23 Correct 392 ms 8276 KB Output is correct
24 Correct 371 ms 6828 KB Output is correct
25 Correct 3931 ms 7960 KB Output is correct
26 Execution timed out 4073 ms 7524 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -