# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
543942 |
2022-03-31T16:46:13 Z |
okkuu |
Poi (IOI09_poi) |
C++17 |
|
273 ms |
4188 KB |
//Source.cpp
//いつもの
#ifdef LOCAL
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<list>
#include<array>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<climits>
#include<iomanip>
#include<cctype>
#include<sstream>
#include<regex>
#include<bitset>
#include<random>
#include<complex>
#include<cassert>
#else
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#ifdef ONLINE_JUDGE
#include<atcoder/all>
using namespace atcoder;
#else
#define gcd __gcd
#define lcm __detail::__lcm
#endif
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#ifdef LOCAL
//*
#include<atcoder/all>
using namespace atcoder;
//*/
unsigned popcount(unsigned x){
return __popcnt(x);
}
unsigned popcountll(ull x){
return __popcnt64(x);
}
unsigned parity(unsigned x){
return popcount(x)%2;
}
unsigned parityll(ull x){
return popcountll(x)%2;
}
unsigned clz(unsigned x){
if(x==0)
throw;
unsigned cnt=__lzcnt(x);
return cnt;
}
unsigned clzll(ull x){
if(x==0)
throw;
unsigned cnt=__lzcnt64(x);
return cnt;
}
unsigned ctz(unsigned x){
if(x==0)
throw;
x&=~x+1;
unsigned cnt=0;
if(x&0xffff0000)
cnt|=16;
if(x&0xff00ff00)
cnt|=8;
if(x&0xf0f0f0f0)
cnt|=4;
if(x&0xcccccccc)
cnt|=2;
if(x&0xaaaaaaaa)
cnt|=1;
return cnt;
}
unsigned ctzll(ull x){
if(x==0)
throw;
x&=~x+1;
unsigned cnt=0;
if(x&0xffffffff00000000)
cnt|=32;
if(x&0xffff0000ffff0000)
cnt|=16;
if(x&0xff00ff00ff00ff00)
cnt|=8;
if(x&0xf0f0f0f0f0f0f0f0)
cnt|=4;
if(x&0xcccccccccccccccc)
cnt|=2;
if(x&0xaaaaaaaaaaaaaaaa)
cnt|=1;
return cnt;
}
unsigned ffs(unsigned x){
if(x==0)
return 0;
return ctz(x)+1;
}
unsigned ffsll(ull x){
if(x==0)
return 0;
return ctzll(x)+1;
}
#define __builtin_popcount popcount
#define __builtin_popcountll popcountll
#define __builtin_parity parity
#define __builtin_parityll parityll
#define __builtin_clz clz
#define __builtin_clzll clzll
#define __builtin_ctz ctz
#define __builtin_ctzll ctzll
#define __builtin_ffs ffs
#define __builtin_ffsll ffsll
#endif
constexpr int mod=1e9+7;
constexpr int Mod=998244353;
constexpr int inf=mod;
constexpr ll linf=(ll)mod*mod;
struct fastio{
fastio(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
};
}fio;
template<class T>
bool chmax(T&a,const T&b){
if(a<b){
a=b;
return 1;
}
return 0;
}
template<class T>
bool chmin(T&a,const T&b){
if(a>b){
a=b;
return 1;
}
return 0;
}
bool f[2000][2000];
int sc[2000];
pair<int,pair<int,int>>arr[2000];
int main(){
int n,t,p;
cin>>n>>t>>p;
p--;
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
cin>>f[i][j];
if(!f[i][j])
sc[j]++;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
if(f[i][j]){
arr[i].first-=sc[j];
arr[i].second.first--;
}
}
arr[i].second.second=i;
}
sort(arr,arr+n);
for(int i=0;i<n;i++)
if(arr[i].second.second==p)
cout<<-arr[i].first<<' '<<i+1<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
2 ms |
468 KB |
Output is correct |
8 |
Correct |
2 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
3 ms |
724 KB |
Output is correct |
11 |
Correct |
13 ms |
852 KB |
Output is correct |
12 |
Correct |
15 ms |
1252 KB |
Output is correct |
13 |
Correct |
43 ms |
1820 KB |
Output is correct |
14 |
Correct |
62 ms |
2168 KB |
Output is correct |
15 |
Correct |
101 ms |
2576 KB |
Output is correct |
16 |
Correct |
111 ms |
2836 KB |
Output is correct |
17 |
Correct |
171 ms |
3204 KB |
Output is correct |
18 |
Correct |
196 ms |
3656 KB |
Output is correct |
19 |
Correct |
265 ms |
4188 KB |
Output is correct |
20 |
Correct |
273 ms |
4172 KB |
Output is correct |