为什么没人能A?

P3111 [USACO14DEC] Cow Jog S

kimi0503 @ 2016-10-25 07:02:58

1.bzoj上能A的代码这里A不了

2.我可是找了两份代码的

3.就算bzoj不严格,也不至于在洛谷上只有14分


by fyshunshun @ 2016-12-04 15:59:19

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;
  vector<long long> A;
  for (int i = 0; i < N; i++) {
    long long x, s;
    cin >> x >> s;
    x = -(x + s * T);
    if (A.empty() || x >= A.back()) {
      A.push_back(x);
    } else {
      *upper_bound(A.begin(), A.end(), x) = x;
    }
  }
  cout << A.size() << endl;
  return 0;
}

by Red_w1nE @ 2016-12-04 15:59:59

#include <iostream> 
#include <vector> 
#include <algorithm> 
using namespace std; 
int main() 
{ 
    int N, T;
    cin >> N >> T;
    vector<long long> A;
    for (int i = 0; i < N; i++) {
        long long x, s;
        cin >> x >> s;
        x = -(x + s * T);
        if (A.empty() || x >= A.back()) {
            A.push_back(x); 
        } else { 
            *upper_bound(A.begin(), A.end(), x) = x; 
        } 
    } 
    cout << A.size() << endl; 
    return 0; 
}

by Alloca @ 2016-12-04 16:24:50

#@[kkksc03](/space/show?uid=1)
#@[kkksc03](/space/show?uid=1)
#@[kkksc03](/space/show?uid=1)
#@[kkksc03](/space/show?uid=1)
#@[kkksc03](/space/show?uid=1)

by Alloca @ 2016-12-04 16:27:51

#include <iostream> 
#include <vector> 
#include <algorithm> 
using namespace std; 
int main() 
{ 
    int N, T;
    cin >> N >> T;
    vector<long long> A;
    for (int i = 0; i < N; i++) {
        long long x, s;
        cin >> x >> s;
        x = -(x + s * T);
        if (A.empty() || x >= A.back()) {
            A.push_back(x); 
        } else { 
            *upper_bound(A.begin(), A.end(), x) = x; 
        } 
    } 
    cout << A.size() << endl; 
    return 0; 
}

这完全没有道理啊

@kkksc03


by winmt @ 2016-12-04 23:36:25

这题又是中文翻译是银组同名题目而此题是金组的题。。。

请更正@kkksc03


by zhzh2001 @ 2017-05-27 15:01:51

不要被这个讨论误导了,现在这题已经是银组的了。


上一页 |