提出 #8578653


ソースコード 拡げる

#define DEB
#include <map>
#include <set>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>

#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> bool chmin(T& a,const T& b) {
    if(a>b) {
        a=b;
        return true;
    }
    return false;
}
template<class T> bool chmax(T& a,const T& b) {
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

typedef long long int lint;
typedef pair<lint,lint> pi;

namespace std{
    template<class S,class T>
    ostream &operator <<(ostream& out,const pair<S,T>& a){
        out<<'('<<a.fr<<','<<a.sc<<')';
        return out;
    }
}

//const int INF=5e8;


int n;
lint d[200005];
lint c[200005];
int main(){
    cin>>n;
    lint tot=0;
    lint dig=0;
    REP(i,n){
        cin>>d[i]>>c[i];
        tot+=d[i]*(lint)c[i];
        dig+=c[i];
    }
    lint res=(tot-1)/9+dig-1;
    cout<<res<<endl;


    return 0;
}



提出情報

提出日時
問題 D - Digit Sum Replace
ユーザ hogloid
言語 C++14 (GCC 5.4.1)
得点 500
コード長 1767 Byte
結果 AC
実行時間 116 ms
メモリ 3328 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 2
AC × 20
セット名 テストケース
Sample 00-sample-01.txt, 00-sample-02.txt
All 00-sample-01.txt, 00-sample-02.txt, 01-corner-01.txt, 01-corner-02.txt, 01-corner-03.txt, 02-random-01.txt, 02-random-02.txt, 02-random-03.txt, 02-random-04.txt, 02-random-05.txt, 02-random-06.txt, 02-random-07.txt, 02-random-08.txt, 02-random-09.txt, 02-random-10.txt, 02-random-11.txt, 03-max-01.txt, 03-max-02.txt, 04-min-01.txt, 04-min-02.txt
ケース名 結果 実行時間 メモリ
00-sample-01.txt AC 1 ms 256 KiB
00-sample-02.txt AC 1 ms 256 KiB
01-corner-01.txt AC 1 ms 256 KiB
01-corner-02.txt AC 1 ms 256 KiB
01-corner-03.txt AC 1 ms 256 KiB
02-random-01.txt AC 1 ms 256 KiB
02-random-02.txt AC 1 ms 256 KiB
02-random-03.txt AC 1 ms 256 KiB
02-random-04.txt AC 1 ms 256 KiB
02-random-05.txt AC 1 ms 256 KiB
02-random-06.txt AC 112 ms 3328 KiB
02-random-07.txt AC 113 ms 3328 KiB
02-random-08.txt AC 115 ms 3328 KiB
02-random-09.txt AC 111 ms 3200 KiB
02-random-10.txt AC 116 ms 3328 KiB
02-random-11.txt AC 116 ms 3328 KiB
03-max-01.txt AC 85 ms 2560 KiB
03-max-02.txt AC 1 ms 256 KiB
04-min-01.txt AC 86 ms 2560 KiB
04-min-02.txt AC 1 ms 256 KiB