Submission #685131

# Submission time Handle Problem Language Result Execution time Memory
685131 2023-01-23T14:40:40 Z edogawa_something ACM (COCI19_acm) C++17
50 / 50
3 ms 468 KB
#include<bits/stdc++.h>
#include<chrono>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;  
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string st;
typedef bool bl;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
typedef vector<pii> vpi;
#define pu push
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie();
#define test ll qqqqq;cin>>qqqqq;while(qqqqq--)
#define F first
#define S second
#define forn(i,n) for(ll i=0;i<n;i++)
#define forx(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define pob pop_back
#define all(v) v.begin(),v.end()
#define lb lower_bound
#define ub upper_bound
#define pof pop_front
#define pow powww
#define prtll(x) printf("%lld",x)
#define prtld(x) printf("%Lf",x)
#define prtst(x) printf("%s",x)
#define prtch(x) printf("%c",x)
#define measure chrono::high_resolution_clock::now()
const ll dx[]{1,0,-1,0};
const ll dy[]{0,-1,0,1};
const ll inf=2e18;
const ll mod=1e9+7;
const ll LM=2e7+1;
const ll M=3e6+1;
const ll MM=1002;
const ll MMM=501;
const ld pi=acos(-1);
//const ll mod=998244353;
ll pow(ll r,ll to,ll m=mod){
  ll res=1;
  while(to){
    if((to&1)){
      res*=r,res%=mod;
    }
    r*=r,r%=mod;
    to=(to>>1);
  }
  return res;
}
struct com{
  bl operator()(const pair<pii,st>&x,const pair<pii,st>&y){
    if(x.F.F>y.F.F)
    return 0;
    else if(y.F.F>x.F.F)
    return 1;
    else if(y.F.S>x.F.S)
    return 0;
    else if(y.F.S<x.F.S)
    return 1;
    else if(y.S>x.S)
    return 0;
    return 1;
  }
};
void a(pair<pii,st>&p,st s){
  if(s[0]=='-')
  return;
  else{
    p.F.F++;
    p.F.S+=1200*(s[1]-'0');
    p.F.S+=3600*(s[4]-'0');
    p.F.S+=600*(s[6]-'0');
    p.F.S+=60*(s[7]-'0');
    p.F.S+=10*(s[9]-'0');
    p.F.S+=(s[10]-'0');
  }
}
ll n,m;
vector<pair<pii,st>>v;
int main(){
  fast
  cin>>n>>m;
  pair<pii,st>p;
  forn(i,n){
    p.F.F=p.F.S=0;
    cin>>p.S;
    if(p.S=="NijeZivotJedanACM"){
      forn(j,m)
      cin>>p.S;
      continue;
    }
    forn(j,m){
      st s;
      cin>>s;
      a(p,s);
    }
    v.pb(p);
  }
  p.F.F=p.F.S=0,p.S="NijeZivotJedanACM";
  st s;
  cin>>s;
  forn(i,m){
    cin>>s;
    a(p,s);
  }
  v.pb(p);
  sort(v.begin(),v.end(),com());
  reverse(all(v));
  forn(i,v.size()){
    if(v[i].S=="NijeZivotJedanACM")
    cout<<i+1;
  }
  return 0;
}
/*
*/

Compilation message

acm.cpp: In function 'int main()':
acm.cpp:20:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<std::pair<long long int, long long int>, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define forn(i,n) for(ll i=0;i<n;i++)
......
  114 |   forn(i,v.size()){
      |        ~~~~~~~~~~              
acm.cpp:114:3: note: in expansion of macro 'forn'
  114 |   forn(i,v.size()){
      |   ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct