[Offer收割]编程练习赛7 register

Ended

Participants:506

Verdict:Wrong Answer
Score:10 / 100
Submitted:2016-08-28 14:25:59

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#define maxn 100010
using namespace std;
int m,n;
int prehigh[maxn],sufhigh[maxn];
int pre[maxn],wsum[maxn];
int wi[maxn],hi[maxn];
int main()
{
    //freopen("dd.txt","r",stdin);
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&wi[i],&hi[i]);
        wsum[i]=wsum[i-1]+wi[i];
    }
    int tmpw =0;
    int high = hi[1];
    int last = 1;
    pre[0]=1;
    for(int i=1;i<=n;i++){
        if(tmpw==m){
            last =i;
            prehigh[last] = high;
            high = 0;
            tmpw = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX