usaco-4.4-milk6-passed

这个题目卡了好几天,每提交一次,发现一次问题,考虑问题就要这样周全,哈哈,终于过了,过了。

除掉用经典最小割最大流算法,能过数据,但会超时,还超的不是一般的多,用上合并相同边算法,呵呵,秒过。

这题,网上有很多解法,但就是看不明白。还是我这个好懂,好懂,好懂。

刚提交了这题,这个USACO网站就抽了,上不去了,RTXRBB,还准备再接再励突破呢。

/*
ID: qq104801
LANG: C++
TASK: milk6
QQ:104804687
*/

#include <iostream>
#include <fstream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

const int maxn = 100 + 10;
const int INF = 1000000000;

struct Edge {
  int from, to, cap, flow;
  int cost;
  int weight;
  Edge(int u, int v, int c, int f, int w):
      from(u),to(v),cap(c),flow(f),cost(w) {}
};

struct MCMF {
  int n, m;
  vector<Edge> edges;
  vector<int> G[maxn];
  int inq[maxn];         // 是否在队列中
  int d[maxn];        // Bellman-Ford
  int p[maxn];           // 上一条弧
  int a[maxn];           // 可改进量
  int www[maxn][maxn];   // add cap
  vector<int> ggg[maxn][maxn];//store (u,v) ‘s  serial number
  vector<Edge> edges2;  //backup data

  void backup()
  {
    edges2.clear();
    for(int i=0;i<edges.size();i++)
      edges2.push_back(edges[i]);
  } 

  void prepaire()
  {
    memset(d,0,sizeof(d));
    memset(p,0,sizeof(d));
    memset(a,0,sizeof(a));
    //edges.clear();
    for(int i=0;i<edges2.size();i++)
      edges[i]=edges2[i];
  }

  void init(int n) {
    this->n = n;
    for(int i = 0; i < n; i++) G[i].clear();
    edges.clear();
  }

  void AddEdge(int from, int to, int cap, int cost) {
    edges.push_back(Edge(from, to, cap, 0, cost));
    edges.push_back(Edge(to, from, 0, 0, -cost));
    m = edges.size();
    G[from].push_back(m-2);
    G[to].push_back(m-1);
    www[from][to]+=cap;
  }

  void merge()  //merge same (u,v)
  {
    for(int i=0;i<edges.size();i++)
    {
      Edge& e=edges[i];
      if (e.cap>0)
      {
        e.cap=www[e.from][e.to];
        ggg[e.from][e.to].push_back(i);
        for(int j=i+1;j<edges.size();j++)
        {
          Edge& ee=edges[j];
          if(ee.from==e.from && ee.to==e.to)
          {
            ggg[e.from][e.to].push_back(j);
            ee.cap=0;
          }
        }
      }
    }
  }

  bool BellmanFord(int s, int t, int& flow, int& cost) {
    for(int i = 0; i < n; i++) d[i] = INF;
    memset(inq, 0, sizeof(inq));
    d[s] = 0; inq[s] = 1; p[s] = 0; a[s] = INF;

    queue<int> Q;
    Q.push(s);
    while(!Q.empty()) {
      int u = Q.front(); Q.pop();
      inq[u] = 0;
      for(int i = 0; i < G[u].size(); i++) {
        Edge& e = edges[G[u][i]];
        if(e.cap > e.flow && d[e.to] > d[u] + e.cost) {
          d[e.to] = d[u] + e.cost;
          p[e.to] = G[u][i];
          a[e.to] = min(a[u], e.cap - e.flow);
          if(!inq[e.to]) { Q.push(e.to); inq[e.to] = 1; }
        }
      }
    }
    if(d[t] == INF) return false;
    flow += a[t];
    cost += d[t] * a[t];
    for(int u = t; u != s; u = edges[p[u]].from) {
      edges[p[u]].flow += a[t];
      edges[p[u]^1].flow -= a[t];
    }
    return true;
  }

  // 需要保证初始网络中没有负权圈
  int MincostMaxflow(int s, int t, int& cost) {
    int flow = 0; cost = 0;
    while(BellmanFord(s, t, flow, cost));
    return flow;
  }

};

MCMF g;
int n,m;
vector<int> G[maxn];

int cmp(const void *a,const void *b)
{
  return *(int*)a<*(int*)b;
}

void test()
{
    freopen("milk6.in","r",stdin);
    freopen("milk6.out","w",stdout);
    cin>>n>>m;
    int u,v,c;
    g.init(n+1);
    for(int i=1;i<=m;i++)
    {
        cin>>u>>v>>c;
        g.AddEdge(u,v,c,0);
    }
    g.merge();
    g.backup();
    int cost;
    int flow=g.MincostMaxflow(1,n,cost);
    //cout<<flow<<endl;

    vector<int>mincut;
    vector<int>ff;
    int total=flow;

    if(flow==0)
    {
      cout<<"0 0"<<endl;
      return;
    }

    int loopcount=g.edges.size();
    for(int i=0;i<loopcount;i++)
    {
      g.prepaire();
      int cap=g.edges[i].cap;
      g.edges[i].cap=0;
      int tt=g.MincostMaxflow(1,n,cost);
      ff.push_back(tt);
      Edge& e=g.edges[i];
      //cout<<i<<" "<<tt<<" "<<cap<<" "
      //<<" from:"<<e.from<<" "<<e.to<<" size:"<<g.ggg[e.from][e.to].size()<<endl;
      if(total==0)  break;
    }

    g.prepaire();
    for(int i=0;i<loopcount;i++)
    {
      //cout<<i<<"*"<<ff[i]<<"*"<<g.edges[i].cap<<endl;
      if(ff[i]==0 && flow==g.edges[i].cap)
      {
        Edge& e=g.edges[i];
        if(g.ggg[e.from][e.to].size()>0)
          for(int j=0;j<g.ggg[e.from][e.to].size();j++)
            mincut.push_back(g.ggg[e.from][e.to][j]/2+1);
        else
            mincut.push_back(i/2+1);
        if(total-e.cap==0)
          break;
      }
    }
    if(mincut.size()==0)
    {
      for(int i=0;i<loopcount;i++)
      {
        //cout<<i<<"*"<<ff[i]<<"*"<<g.edges[i].cap<<endl;
        Edge& e=g.edges[i];
        if(g.edges[i].cap==0)
          continue;
        if(flow==g.edges[i].cap+ff[i] && e.cap>0 && ff[i]>0)
        {
          if(g.ggg[e.from][e.to].size()>0)
            for(int j=0;j<g.ggg[e.from][e.to].size();j++)
              mincut.push_back(g.ggg[e.from][e.to][j]/2+1);
          else
              mincut.push_back(i/2+1);
        }
      }
    }

    sort(mincut.begin(),mincut.end());

    cout<<flow<<" "<<mincut.size()<<endl;
    for(int i=0;i<mincut.size();++i)
      cout<<mincut[i]<<endl;

}

int main ()
{
    test();
    return 0;
}

test data:

USACO Training
Grader Results
7 users online
CHN/2 TWN/1 USA/4

USER: cn tom [qq104801]
TASK: milk6
LANG: C++

Compiling...
Compile: OK

Executing...
   Test 1: TEST OK [0.011 secs, 3708 KB]
   Test 2: TEST OK [0.008 secs, 3708 KB]
   Test 3: TEST OK [0.011 secs, 3708 KB]
   Test 4: TEST OK [0.011 secs, 3708 KB]
   Test 5: TEST OK [0.143 secs, 3708 KB]
   Test 6: TEST OK [0.027 secs, 3708 KB]
   Test 7: TEST OK [0.016 secs, 3708 KB]
   Test 8: TEST OK [0.030 secs, 3708 KB]
   Test 9: TEST OK [0.146 secs, 3708 KB]
   Test 10: TEST OK [0.756 secs, 3708 KB]
   Test 11: TEST OK [0.003 secs, 3708 KB]
   Test 12: TEST OK [0.008 secs, 3708 KB]

All tests OK.

Your program (‘milk6‘) produced all correct answers! This is your submission #13 for this problem. Congratulations!

Here are the test data inputs:

------- test 1 ----
4 5
1 3 100
3 2 50
2 4 60
1 2 40
2 3 80
------- test 2 ----
8 9
1 2 2
1 3 1
3 4 1
2 4 2
4 5 3
5 6 1
5 7 2
7 8 2
6 8 1
------- test 3 ----
10 10
1 3 10
2 3 10
3 4 10
4 5 10
5 4 10
2 10 20
8 2 10
5 7 10
6 9 10
9 8 10
------- test 4 ----
10 40
1 10 72
1 10 590
1 10 554
1 10 436
1 10 817
1 10 695
1 10 122
1 10 650
1 10 510
1 10 266
1 10 803
1 10 882
1 10 572
1 10 998
1 10 783
1 10 799
1 10 933
1 10 793
1 10 422
1 10 354
1 10 585
1 10 527
1 10 199
1 10 425
1 10 343
1 10 108
1 10 891
1 10 492
1 10 287
1 10 667
1 10 654
1 10 359
1 10 256
1 10 208
1 10 794
1 10 73
1 10 902
1 10 916
1 10 723
1 10 412
------- test 5 ----
4 1000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
1 4 2000000
------- test 6 ----
10 200
5 10 3
3 10 5
2 5 1
4 10 1
3 8 1
3 8 1
2 10 1
4 6 1
4 6 1
2 5 3
3 5 1
4 10 1
5 10 1
1 7 2
4 6 1
4 10 1
2 10 1
5 10 3
3 6 1
3 10 1
3 5 1
1 10 2
3 10 4
1 10 1
2 9 1
2 7 1
4 10 2
4 10 1
5 6 1
2 7 1
5 6 1
3 6 1
5 10 1
1 9 3
5 7 2
5 9 1
3 4 1
5 10 1
4 10 1
4 10 1
2 8 1
1 3 1
4 6 1
2 5 4
4 7 1
5 8 1
3 10 1
4 10 3
4 6 2
4 10 1
2 4 3
5 8 1
4 5 1
1 5 1
3 4 5
4 10 4
3 8 3
1 3 1
4 10 1
4 10 1
3 10 1
5 10 1
3 8 3
1 7 2
1 10 3
2 10 3
5 7 1
1 5 1
4 10 1
3 10 1
1 2 3
5 10 4
5 9 1
5 10 4
2 8 3
4 10 1
1 10 1
5 10 4
5 10 4
4 5 1
2 5 2
4 6 4
5 10 2
3 10 1
4 5 3
5 10 2
5 10 4
5 10 2
2 6 1
5 7 1
5 9 3
1 2 2
1 10 1
3 8 1
2 4 1
4 5 1
1 10 5
2 10 1
3 5 4
1 2 1
5 10 1
5 10 1
1 2 1
1 7 2
1 10 1
5 10 2
3 10 5
4 5 1
3 8 4
4 10 4
1 7 3
4 10 1
3 9 2
1 9 1
2 10 3
4 10 2
1 3 1
2 10 1
2 7 3
3 6 1
5 8 2
5 6 1
1 7 4
2 10 3
5 6 1
2 9 1
2 9 1
5 10 1
4 7 2
5 10 2
4 10 1
1 9 1
5 10 4
3 4 1
3 10 1
3 5 1
1 6 4
5 10 3
3 5 3
4 5 5
1 9 1
4 10 1
2 10 1
4 7 1
3 10 2
3 7 1
1 6 1
2 6 4
3 10 1
5 10 1
1 7 1
1 4 2
5 10 1
2 5 2
5 10 1
2 5 5
5 9 1
5 10 4
2 4 1
5 6 3
4 7 1
5 10 4
1 4 1
1 8 1
1 7 1
1 10 1
2 10 3
1 8 1
1 2 4
1 2 5
3 10 4
3 9 1
4 10 3
3 10 1
4 10 3
3 4 1
3 8 1
5 10 1
1 8 1
2 9 1
3 4 2
1 7 1
5 7 1
1 9 2
5 9 5
2 10 1
4 8 1
4 7 5
3 7 1
2 8 1
5 7 1
2 4 3
2 3 2
5 7 1
2 3 2
4 9 3
5 7 4
4 10 1
5 10 1
5 10 1
------- test 7 ----
15 100
8 1 9367
7 4 6605
1 10 9853
12 10 2296
10 5 8313
3 5 750
11 11 3778
7 13 1345
4 10 8914
6 7 8348
3 14 8636
2 5 667
12 6 6992
11 3 3033
15 12 5838
12 14 9093
13 10 5804
4 2 4158
6 6 656
5 11 4744
2 13 3566
15 15 6590
1 11 142
11 7 1548
1 6 9054
10 3 8171
8 1 4526
2 4 5365
8 10 8738
9 14 5814
1 1 4349
7 15 3710
2 1 500
2 12 4574
4 12 8226
3 6 9768
15 14 9949
7 1 2548
15 9 8908
13 3 7944
7 4 8003
13 10 7719
4 11 7761
5 12 5118
11 1 2824
9 3 6717
8 3 5888
8 9 6140
12 9 1632
11 6 3019
7 12 5044
4 10 1273
1 14 8295
13 3 6252
5 13 6690
10 7 8664
5 15 345
13 7 6257
8 4 1764
10 14 5604
15 6 3590
7 10 71
9 11 8756
7 8 144
1 12 8809
11 7 2978
9 11 2417
9 9 7075
4 1 9499
7 10 8598
15 10 2315
5 1 8653
5 10 5331
4 1 109
4 1 8103
2 12 2140
6 5 8934
10 14 4372
6 3 4595
5 9 1234
3 8 7308
6 13 7860
4 3 4164
12 6 4515
12 9 5163
10 11 2798
13 2 6085
11 11 5366
3 1 6900
10 6 2448
11 8 7614
7 14 5988
4 3 7642
10 15 1328
2 11 7192
10 6 4041
14 3 4854
8 14 2046
1 1 2691
12 10 6288
------- test 8 ----
20 100
11 14 4810
15 19 2097
14 14 9431
3 9 4340
5 12 9446
1 12 207
10 14 839
7 8 5383
6 7 2457
16 17 792
7 8 7454
6 18 4606
2 19 1388
1 8 2420
10 20 4532
9 20 208
9 14 4966
1 11 8027
2 6 1139
1 6 9187
8 9 2602
3 7 5156
8 12 4592
9 15 8507
18 20 8333
7 9 8258
9 15 4860
5 19 5143
6 15 7969
12 18 8314
16 20 2630
1 2 5728
11 14 9703
1 8 3986
8 18 2916
14 16 5939
5 11 3262
3 20 5722
11 18 8703
7 15 4661
3 11 4387
9 11 5335
2 20 2110
2 19 6099
7 19 9723
13 13 7512
3 5 9673
3 12 1171
3 14 34
1 20 7400
3 10 2456
11 19 7803
9 10 8596
9 13 9425
6 16 8798
5 9 5047
13 20 6430
5 19 7806
2 7 4317
2 7 3933
17 17 4967
2 15 48
3 17 4906
14 16 9240
2 13 7038
6 11 1214
1 6 7706
5 14 9777
6 9 3147
8 18 6520
4 6 4554
5 16 1638
2 16 3104
6 16 1062
4 8 1611
18 19 4474
1 19 7161
12 16 9344
1 16 2195
2 19 5747
4 15 7399
4 20 9608
7 15 176
14 20 7698
4 16 1600
2 19 677
2 8 9978
2 18 5933
1 13 6345
5 14 5534
9 17 7430
12 13 7000
11 20 4291
11 13 4210
7 8 5995
6 10 6685
11 14 7492
11 16 6123
3 16 2355
1 16 9332
------- test 9 ----
25 400
7 9 687609
9 18 887081
8 17 413462
1 5 960664
19 21 1531689
15 23 875161
10 20 1790862
9 10 667264
14 20 164009
19 25 801667
20 25 1039367
7 11 729699
16 24 452572
20 25 1074297
10 17 1375788
5 10 797948
14 23 621814
12 15 657210
19 25 1821114
20 25 1101195
8 18 991781
19 22 1776585
6 7 1268669
10 11 799486
1 6 140728
15 23 963799
3 8 707674
9 19 1263169
16 25 1197960
14 23 1005100
5 8 810768
15 17 1302574
13 18 1367598
5 15 1419301
13 23 418347
15 23 1896425
4 13 728696
11 14 706021
4 5 495664
16 24 261633
6 16 805596
14 21 1166919
7 10 75301
1 7 1983313
15 17 1965253
19 25 1396908
18 19 1076225
6 13 1625017
13 21 1700494
18 24 1123769
20 25 996036
8 14 309076
20 25 839473
1 10 1855896
1 8 157831
20 25 1886005
14 19 4216
5 13 1220138
1 5 796940
18 20 1932579
9 11 1632156
19 25 706437
2 8 457998
11 17 254434
9 15 1515046
11 17 658180
10 12 1580263
10 15 1009988
2 7 1653376
10 14 6090
9 17 329763
6 14 1429991
13 22 473692
17 21 1536166
20 25 600726
15 19 1632625
2 10 28769
17 20 865383
8 12 1767485
4 12 435566
4 7 1993395
7 13 1437007
2 4 1075479
6 16 1748282
2 12 1311312
8 15 1922399
4 12 1467549
4 10 1950976
13 23 592819
11 12 190017
15 18 675149
15 22 1680369
9 16 1912114
20 25 1828382
18 19 1683606
11 16 992831
10 16 414236
5 13 1528085
4 9 1344364
10 20 1516448
12 19 50427
19 23 1276064
16 25 623349
15 24 565974
13 20 640105
10 12 1446467
20 25 617685
4 13 182527
19 20 1006376
13 19 856716
8 10 169112
8 9 936958
1 9 597261
7 12 225498
13 15 1569952
19 25 1941933
14 20 1263839
20 25 1003220
2 9 1111051
12 15 180151
20 25 400537
2 12 447357
11 12 979
17 21 973517
20 25 1193352
15 25 344089
15 21 1418558
7 13 830996
18 25 109486
9 11 598392
10 12 1814162
14 17 1807222
19 25 1853636
19 25 576752
9 16 542543
1 5 391114
4 5 1568933
18 23 693682
7 10 1947890
8 15 337931
14 16 720521
12 21 1264771
10 19 907638
8 16 246381
14 16 1506500
20 22 257946
3 7 442651
19 21 1324454
6 12 1906574
6 15 1300063
9 15 1685071
16 17 1462134
9 15 1078608
18 25 535472
20 25 806243
15 21 1084272
18 25 1713648
2 9 112929
16 25 1113109
15 17 823675
8 14 1843016
5 9 1985295
19 25 1057733
10 17 913965
15 22 130743
3 7 1250609
14 17 664677
11 15 1941880
12 14 1775899
4 13 114624
12 14 1295985
10 14 40503
10 14 1612949
1 9 920960
10 16 210917
11 18 989319
4 8 1514112
10 20 227947
10 16 455277
7 14 102675
9 12 470205
2 10 1242938
2 4 1883006
18 21 1469017
7 14 536443
9 12 1891526
19 23 618536
14 23 431121
17 21 1442209
1 8 764909
2 3 1222895
7 9 659183
19 22 1059069
18 19 1480283
13 18 836792
18 25 1259338
17 25 1998528
3 9 1719041
8 12 362756
2 6 1705571
10 15 1862109
2 10 128356
9 17 544814
19 25 724431
14 17 1588168
2 4 1346942
15 25 990069
15 17 31663
12 18 699669
16 22 1449364
13 14 383423
11 13 1972050
13 19 1458183
18 23 724828
5 7 1241001
1 4 1543145
15 25 1522785
5 13 1798456
5 8 801278
12 13 1973460
7 14 79910
10 13 343523
10 19 1423482
5 13 378854
12 22 689923
4 5 1193479
20 25 1148861
15 25 554596
13 15 1129724
1 9 1237002
1 2 581999
2 8 1026824
5 6 699833
19 22 145838
3 11 89271
10 20 118298
2 12 1579862
13 20 1464030
19 23 1802465
10 14 1294836
3 7 1390504
8 12 472894
19 25 514054
6 12 972167
7 14 572061
8 10 554736
9 12 463337
5 14 1820649
20 25 425127
18 21 1078048
11 15 1752872
4 12 529509
9 16 1751481
14 23 842270
4 7 180728
10 16 456778
15 16 863899
20 23 550951
18 21 72530
2 3 558358
13 19 1245439
11 19 715771
16 18 1996177
14 23 1786491
2 3 232550
4 10 1423625
8 11 1478013
17 20 1975577
2 4 380346
3 6 494784
9 18 1613727
1 5 1127679
8 10 1509534
8 16 1273345
6 15 1391278
9 10 435394
3 8 960428
18 21 1429717
17 21 1663910
1 6 88131
6 15 1780430
2 12 493677
13 17 757380
9 17 323021
1 11 32870
15 19 67653
20 25 884150
9 13 1346258
3 5 4929
20 23 932691
1 7 687902
19 25 516002
4 7 1132761
11 18 534356
15 22 507276
15 20 1284073
16 20 288370
4 13 998181
18 25 1389081
18 25 1841416
7 17 849969
14 23 28467
19 20 504588
11 17 1787866
16 19 1151645
1 11 1987202
14 22 729930
17 25 340258
7 16 247901
1 8 116769
19 20 34992
8 15 1783001
8 15 1854471
13 15 1006782
11 21 1562954
2 12 1555858
2 9 1053146
9 14 938967
13 21 559580
15 23 1919912
16 23 1952652
17 18 1345704
15 19 615069
13 23 893508
3 9 715375
19 25 587947
14 21 1795296
5 7 625793
14 22 77618
20 25 1539850
19 22 853906
19 20 869754
12 20 1615860
18 23 1596810
7 13 600471
14 19 1778486
20 22 1118057
18 23 1349113
4 5 811913
5 6 1754356
1 2 293211
9 19 463470
18 23 48133
14 18 901671
10 18 30866
16 21 998669
14 19 1360940
5 8 170823
18 23 367284
7 15 509904
4 12 518593
7 9 346003
12 13 1337838
12 20 109167
1 3 1553498
2 12 386203
11 18 1195231
5 14 1775876
7 15 753932
10 11 207014
16 19 1674974
1 7 11717
4 6 86996
18 25 1516670
19 25 1897551
14 22 1830107
18 22 1092826
10 16 803763
8 17 312032
15 19 429544
17 19 910656
14 16 48576
14 18 306775
15 18 1733385
10 12 1230076
9 18 827713
8 15 1524967
19 21 682775
7 13 471961
10 13 1259807
14 16 1556218
3 11 1879785
4 9 576511
7 10 984234
4 12 1212120
16 18 813667
5 11 175077
20 25 491582
7 15 1539055
11 13 71430
4 13 295719
20 25 1886896
18 20 856677
4 9 1292058
14 21 709708
6 10 1007177
14 20 14573
16 22 824722
1 10 241385
16 21 576594
------- test 10 ----
32 1000
19 28 1080726
26 30 842618
1 8 999670
7 10 1837788
7 16 498455
15 20 1058846
18 19 1011985
4 14 1569261
7 16 943581
5 11 1307214
9 12 965943
24 26 1750363
8 10 984350
22 26 1517863
19 26 1155481
26 28 117910
13 21 174876
27 32 38613
21 23 1661987
7 11 720075
25 32 1161832
11 16 1456553
7 15 1763422
21 27 527242
14 17 1738974
3 5 15702
4 11 1554682
7 14 1326322
7 12 1614040
3 10 250039
12 18 1522053
1 11 510807
21 23 58919
17 27 1166059
25 30 1670015
21 27 69239
21 28 1422579
15 24 742017
6 8 1596815
1 4 930553
4 11 50444
25 32 1922431
5 10 296876
6 7 158128
21 31 1024051
17 24 50123
18 23 1354256
10 20 1111325
20 23 1359942
15 18 1762093
27 31 1037853
1 4 349054
27 32 1152247
4 11 1210854
6 10 1052117
20 30 415009
20 27 1315233
12 22 1307469
27 32 1718040
18 21 160985
15 18 886341
2 5 1416162
7 9 261253
22 26 1480534
11 17 240063
26 29 209855
4 14 1459148
22 26 1410520
13 17 805988
9 19 1242366
11 17 1650207
23 29 79955
15 23 454040
19 25 1069339
12 22 83979
15 25 522011
18 19 433556
10 19 1172872
2 6 1851281
13 20 1828724
3 4 867295
25 32 4846
26 30 1590431
6 7 776294
20 25 773291
21 22 633536
1 8 772039
7 8 504032
23 24 1136984
21 27 388934
19 26 420867
3 9 119124
3 9 899865
25 32 1024345
8 13 1973096
19 22 1986180
27 30 1273454
11 16 1294063
18 22 1458526
6 7 572833
11 19 1879347
17 26 1028275
18 28 99573
4 13 1547279
17 19 440733
17 26 863912
17 25 1338829
7 9 299037
24 32 917408
17 18 1045223
25 29 511205
23 32 182649
10 17 64400
12 20 1746888
5 10 6407
11 12 1616247
23 30 1209944
14 23 1559536
18 26 1169055
4 8 1175484
18 21 1967757
25 27 1966740
27 32 1291557
1 10 842072
24 25 1642629
25 30 1666324
19 22 899337
9 17 615120
3 8 107736
19 25 835710
7 9 1371875
7 8 1595578
6 7 535091
24 25 289989
8 18 407550
3 12 1328505
26 32 1916767
11 20 1511163
19 29 410730
21 28 1532877
5 14 1922825
24 25 91780
18 22 222390
25 27 379054
2 7 308660
8 14 17612
26 32 1122158
25 32 832241
18 25 707395
24 28 1916675
17 23 1635564
16 21 1831819
18 19 472179
21 31 848201
26 27 1801955
3 7 976070
3 6 36869
18 20 1883690
2 11 1131651
12 19 1888488
11 14 989911
6 15 1807794
4 10 1937715
10 13 1914764
21 23 28931
19 22 687764
5 9 1219768
5 6 1541708
4 5 1164748
19 25 499618
18 27 1079192
4 5 826297
1 4 1832712
1 7 320826
26 30 669693
27 28 1187972
9 11 1893276
26 30 1907762
19 24 63669
8 10 1068392
15 24 838606
2 12 1009873
14 24 1414012
11 21 523202
16 26 1185642
25 32 1203288
14 17 1552207
12 14 269270
11 20 1238166
12 14 1590545
26 32 1214896
11 19 1101129
24 27 1057038
16 23 1020336
23 26 905787
12 13 742321
2 8 1217702
23 24 1551696
26 31 1286012
16 25 1585396
10 18 949468
27 29 457417
15 16 935542
2 9 216553
16 21 621275
1 11 819402
11 21 1998904
27 32 53057
21 29 889622
12 16 572269
6 14 169388
19 26 519586
25 28 632734
11 14 1922845
14 23 913119
22 31 789198
6 9 754369
6 9 360840
7 8 1877879
19 24 543652
27 32 1948703
2 6 1307928
9 12 1722456
17 24 249323
16 18 1908866
2 12 1606871
12 14 85658
23 27 562929
27 32 590380
26 29 1454022
6 9 739250
5 8 1395532
23 29 1880283
19 22 1129046
23 32 1358373
22 31 1189539
16 19 1441945
17 19 114494
25 27 1260242
6 7 1768812
26 29 212472
9 14 760609
27 30 1932808
26 32 361805
14 22 1970442
5 11 1671838
21 23 255191
14 22 474868
15 22 691710
5 14 783595
2 11 1294174
5 7 172149
15 17 725448
15 16 676525
19 25 274704
19 27 1428851
15 20 1745836
18 28 1311316
24 30 688221
7 15 466930
17 25 101466
8 18 331077
10 16 551294
20 21 642401
2 10 1733443
6 11 1182793
25 32 179988
22 28 166973
12 17 1258242
22 30 714037
1 5 303168
2 9 238107
7 17 1279462
14 21 1360042
23 31 841649
19 29 1694727
8 17 1591113
11 18 785997
13 14 1754247
3 12 1187572
13 22 1869567
17 27 1094406
20 22 1034237
10 17 414508
2 8 1911743
13 16 1800645
9 14 1510067
3 12 785841
14 18 939285
11 16 658618
27 32 410770
25 30 297207
13 15 649005
27 32 17457
5 11 1044965
4 5 1464971
1 5 460267
22 27 210840
5 15 883664
18 22 1736981
27 30 1484827
5 7 430369
9 16 811714
18 24 1908323
18 26 1080239
5 14 1169110
25 32 1869662
4 12 773010
7 16 665148
19 25 1300324
16 22 1866109
9 16 232070
15 16 1492611
26 32 681970
24 28 214655
12 18 2406
1 6 1845869
26 32 1255111
9 18 1015971
18 24 67735
9 10 1069020
7 11 430596
10 20 449669
3 12 1775244
13 21 424778
15 17 1443234
15 17 295584
13 14 1442093
3 8 1093600
17 18 133770
18 22 299582
5 12 1075865
11 21 892985
17 18 562655
14 20 1993199
20 21 264856
12 19 546734
16 18 708495
9 12 1523149
24 32 1655842
25 30 406900
3 10 1642430
17 18 1594502
2 9 1755728
10 12 808076
10 20 966200
13 17 232507
21 31 452865
3 6 882384
24 26 537035
19 20 1484553
25 27 793957
20 28 895843
14 22 239879
11 13 601308
22 27 404907
8 18 1093911
11 18 963902
17 25 1456973
2 9 1666723
9 13 1726922
2 5 1937150
13 23 1373272
25 30 928273
1 10 1164807
10 17 76072
15 24 1926925
3 6 1264099
16 25 796088
8 18 46041
4 7 669799
27 31 1074261
26 32 901857
18 26 1747088
3 11 1365683
19 20 565716
20 27 313386
19 26 841201
9 12 602025
20 26 478242
21 28 1006887
3 10 1672513
17 24 1269075
2 5 692417
26 30 182416
17 18 340380
25 32 1571215
2 8 968831
14 23 1497132
22 28 613088
1 5 1983425
15 19 1335061
10 11 605148
1 2 1166956
10 11 1948758
12 19 115360
17 23 1742834
11 18 758105
24 26 425271
17 26 1540421
26 32 149594
25 30 922589
17 26 933666
25 32 1084681
13 15 1122722
13 20 413471
14 17 1522644
11 18 763626
21 26 977617
27 29 766642
21 22 608942
23 32 1511404
8 14 1146541
21 26 783427
8 18 1114478
23 27 322110
2 12 746701
23 26 1959465
6 7 929235
19 20 1153140
2 10 1244269
11 17 1186046
4 13 313531
20 27 1231872
3 13 1108023
18 26 1890743
23 32 1695391
6 13 264801
5 14 357077
18 24 397490
6 12 1926459
23 32 1093579
12 14 821438
16 25 43702
6 16 1845049
21 27 1348201
19 23 966630
15 21 222978
19 27 1880870
24 28 917924
2 8 100780
1 6 38379
16 25 242125
27 32 1858559
27 32 1671106
25 29 794244
17 18 1550082
3 10 685321
6 9 159425
4 6 901628
16 19 65070
18 21 894019
18 26 574520
22 30 1420104
20 28 662640
15 22 1410153
26 29 1553386
20 24 787728
2 8 1377981
4 11 1681221
16 19 94938
17 27 545590
2 8 126756
10 14 1659874
2 3 1188645
11 17 558118
3 9 1116493
24 27 1830400
8 12 922816
26 31 274610
22 23 803705
23 30 610882
4 12 1734517
6 7 416737
1 3 516098
17 23 1703707
25 32 773807
13 19 1276479
10 19 1897043
23 31 794923
26 32 871747
10 15 192585
19 25 1651456
15 23 1822879
21 29 126957
1 5 1226332
24 27 531155
7 14 1594812
24 25 1205030
23 32 739791
7 16 1880314
18 21 721537
21 30 1809050
16 21 1269609
14 16 763087
16 18 1478128
5 6 1972850
12 15 1363747
7 9 1481216
23 32 1248074
6 8 938929
4 13 1357486
14 21 1114627
12 14 1944868
2 9 264945
12 15 590956
5 10 626609
5 14 1145709
23 24 1424735
16 26 1360729
6 8 1748614
19 22 1460135
10 18 687879
25 28 1083300
24 27 469276
1 8 972764
9 18 1820094
17 18 1542422
6 15 1734559
25 30 1601535
16 23 1883140
13 16 459686
6 13 52712
15 21 471265
3 8 984956
9 14 356870
22 30 65133
20 24 82598
13 19 1773008
10 15 617580
4 5 1864388
3 9 452359
9 17 1738979
10 13 838876
16 20 1696915
2 9 578043
7 12 73215
8 10 809039
9 16 1931224
6 16 864503
15 16 969606
13 15 1995145
19 25 1401256
15 24 1875817
27 32 502127
23 28 1749463
3 11 590588
4 5 845595
15 19 56906
14 20 1959081
26 27 153654
12 18 523764
12 15 1529096
4 12 1222363
2 10 74828
9 15 1071448
6 13 569090
14 22 632889
25 29 1345442
26 32 479755
25 32 653408
27 30 1730789
7 14 164255
1 9 1692786
18 27 1155256
19 21 248580
6 10 1550801
14 23 1135134
22 30 1810617
13 20 1508473
20 26 1093204
2 8 1534416
25 32 827254
27 32 372973
23 28 47391
12 14 352632
15 19 1038160
9 18 694563
24 31 167435
22 24 1513682
15 24 692384
3 12 1857196
24 32 1531880
8 16 1245533
13 20 220516
13 14 531659
18 24 1250407
5 15 945851
15 23 250880
17 23 510936
10 12 205772
20 23 1988796
18 19 1590796
11 15 1176026
1 9 437272
4 7 529789
11 21 1702157
1 2 1505175
14 21 1073978
17 20 219183
24 30 449261
27 31 857417
27 32 978064
21 25 1638457
10 14 1211568
16 22 1744788
23 32 1590748
19 29 1787608
13 18 1029930
27 28 1485150
3 13 666948
9 19 1267708
21 31 1144627
7 14 1829582
2 3 568108
18 25 1580718
15 20 1399073
9 11 1273577
7 14 150082
20 27 279467
14 22 172669
23 24 35458
13 21 1856630
1 2 1226979
26 27 1322532
6 14 580561
1 4 1530855
20 27 1875569
10 19 1119878
12 18 337760
16 17 1748397
18 27 1801050
19 23 1353136
17 21 1382718
6 9 1528252
24 30 1001306
5 11 1546667
25 28 755084
24 30 414164
12 22 1553837
16 22 1659251
13 16 1397356
10 19 35858
2 7 719383
20 27 1277515
14 20 278359
27 32 1302634
21 28 1749412
5 10 892269
10 20 881285
4 10 1995929
27 32 408868
18 22 155559
19 23 1092633
2 4 447067
19 26 1541393
23 30 956172
13 17 222259
10 16 1215221
22 32 1054937
7 8 79165
7 8 36302
12 19 727398
14 18 1505589
2 6 1753592
8 9 999659
2 11 245095
15 19 1036567
18 25 129160
7 12 1937036
21 29 14033
23 32 19401
23 27 1350495
6 15 43172
26 32 816816
23 26 948940
9 12 717905
13 22 1426342
27 32 823665
1 9 1802142
1 6 1243055
1 4 1142335
1 3 1908848
19 23 1698153
20 23 1602883
4 6 70102
17 22 641204
26 32 272361
19 28 1185831
3 12 596835
27 32 1560308
17 26 155416
5 15 418459
4 11 1076834
27 31 1636130
22 27 1849938
23 24 717916
4 14 485158
8 15 188230
24 32 1956294
5 13 1726383
26 30 1512532
1 7 1334140
7 14 541701
21 28 1178387
16 20 61013
14 17 138518
24 28 128807
4 11 1458222
6 11 950428
6 13 407565
2 8 1072688
22 29 88133
13 22 1362747
21 28 594684
9 11 1386824
10 18 1809271
12 18 503226
14 21 1741052
7 17 708577
19 20 2637
25 27 1183538
12 22 406697
14 19 90570
5 7 1311993
13 18 1707095
5 14 1125814
2 5 286065
9 17 1673005
5 6 1474864
15 23 1647936
15 22 1918602
4 5 1799396
10 16 624456
11 19 935482
1 3 1910861
25 29 1611606
13 17 176232
17 24 1733549
12 21 1741777
5 10 1151343
27 32 369812
26 27 469870
24 29 1539652
5 14 941903
18 27 1271306
16 24 1914686
11 13 681312
13 21 74411
10 13 1835034
6 10 671757
22 26 587217
27 31 764951
6 8 1611656
27 31 1217902
13 23 895680
3 9 352087
2 12 712936
11 16 264292
12 20 679159
10 11 1432402
19 27 171955
27 32 816420
10 20 1165193
5 15 1842729
21 26 1784510
6 12 901396
11 17 804993
21 31 1671532
24 28 1234562
7 15 1235859
26 31 826765
1 5 377092
12 20 356709
1 10 305268
26 32 1164671
23 32 206225
8 11 1344614
19 20 1261150
14 24 30245
4 6 1486930
21 22 302963
5 7 1065559
10 16 539670
15 21 336949
19 24 1675300
8 12 1450401
11 17 14339
2 5 80050
19 27 1911825
19 29 188825
12 19 343449
16 25 547653
4 7 1617855
11 19 719249
16 21 1694563
11 18 328307
4 5 1521876
4 6 80263
5 13 1675000
4 9 1540647
6 16 913063
11 16 619012
18 25 1035586
13 23 519493
23 29 1375999
19 29 769776
23 24 907048
17 19 1132427
18 22 707065
13 18 1661204
7 14 1481776
20 21 471742
1 9 1696661
15 18 1696203
22 23 807316
14 22 705299
24 30 840554
9 11 1227418
24 32 1945939
7 10 907944
2 8 302255
22 25 472321
2 5 1965795
25 32 400530
21 27 495776
4 5 1946096
14 24 1079797
25 28 1418753
15 17 1043227
14 18 1628219
26 31 714374
4 7 1214756
10 14 1748376
9 12 1350820
15 25 541580
22 24 696656
21 28 585823
8 14 1116129
1 2 1420001
15 21 204502
10 16 1130837
19 26 1680782
9 19 326077
5 9 763383
24 32 688902
4 11 909949
13 17 131824
21 28 1195080
9 16 1327134
1 4 473926
4 10 1543398
19 22 837805
15 21 829468
19 27 1484181
3 9 1202473
12 19 480120
24 26 1263218
26 32 631564
15 18 3909
6 9 423480
13 18 1518495
6 8 3328
18 25 1092735
2 6 535091
22 27 1681214
11 20 1072686
18 26 1406161
8 16 1267462
16 19 1772719
16 21 341930
22 32 1179598
16 18 1416559
16 24 733594
3 12 1456778
11 18 349495
6 7 100645
21 28 1620177
13 23 1039914
3 9 1554937
27 28 492379
4 13 326166
20 25 599695
12 13 150771
22 24 1808863
15 20 1058149
20 28 1101104
21 26 417846
16 26 271592
3 13 1293908
24 32 1488701
4 6 1279452
8 17 184655
16 19 207639
18 19 441137
16 23 1420241
3 7 826163
18 20 1731589
23 30 1542680
27 32 1526896
18 25 1456957
11 19 1674792
1 2 1359997
3 10 1929133
6 9 115790
12 21 1376748
4 14 61501
15 21 270693
12 16 1624499
6 10 1162834
26 27 440634
19 23 1950278
15 20 17930
6 12 1243285
5 13 1777113
7 9 1428277
25 28 1254924
26 32 358160
3 6 1155828
25 30 1919522
13 18 1943147
19 20 715406
18 25 1515748
19 28 528829
9 19 1962286
6 8 257257
25 27 833981
15 16 518621
20 22 1042766
8 9 1949096
7 12 764506
6 8 945953
16 25 168228
9 15 1791327
17 26 1744384
16 17 143187
20 30 364485
4 9 469778
11 13 729759
25 30 768926
24 31 1750113
8 17 113955
20 25 1810727
23 31 858360
20 24 500138
16 26 513175
18 25 325745
23 31 1192774
2 4 1472420
12 13 320511
23 32 1656570
19 22 1423742
21 31 337433
18 26 1913391
3 8 680444
10 11 600878
17 25 1931950
21 27 1507640
10 17 1846567
3 4 1991499
7 16 1891530
3 9 311165
22 26 196358
26 32 1715334
25 26 659421
7 12 773002
16 17 199265
15 23 1302694
8 10 553066
6 9 680141
6 11 452843
4 10 1621287
9 13 299426
11 15 297987
7 10 475328
16 21 1331589
27 28 1379942
2 8 946133
20 29 1222934
27 28 1682765
10 13 646137
16 20 1769620
11 18 476953
15 16 1105571
19 23 1568863
25 32 547273
16 25 641678
8 18 1784029
20 27 1481964
10 17 1582049
6 7 75785
14 20 854700
11 21 229959
18 23 397919
6 8 1073914
27 28 917363
7 14 701270
16 26 624898
13 20 1990941
6 7 1352463
------- test 11 ----
5 4
1 4 100
3 2 10
4 3 10
2 5 100
------- test 12 ----
5 4
1 4 100
4 3 10
3 2 10
2 5 100

Keep up the good work!
Thanks for your submission!

时间: 2024-11-05 17:18:02

usaco-4.4-milk6-passed的相关文章

COGS 696. [IOI1996][USACO 2.3] 最长前缀

★   输入文件:prefix.in   输出文件:prefix.out   简单对比时间限制:1 s   内存限制:128 MB 描述 USACO 2.3.1 IOI96 在生物学中,一些生物的结构是用包含其要素的大写字母序列来表示的.生物学家对于把长的序列分解成较短的序列(即元素)很感兴趣. 如果一个集合 P 中的元素可以通过串联(元素可以重复使用,相当于 Pascal 中的 “+” 运算符)组成一个序列 S ,那么我们认为序列 S 可以分解为 P 中的元素.元素不一定要全部出现(如下例中B

USACO prefix TrieTree + DP

/* ID:kevin_s1 PROG:prefix LANG:C++ */ #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <vector> #include <map> #include <set> #include <algorithm> #include <cstdlib>

【USACO 1.3.4】牛式

[題目描述 ] 下面是一个乘法竖式,如果用我们给定的那n个数字来取代*,可以使式子成立的话,我们就叫这个式子牛式. * * * x * * ---------- * * * * * * ---------- * * * * 数字只能取代*,当然第一位不能为0,况且给定的数字里不包括0. 注意一下在美国的学校中教的"部分乘积",第一部分乘积是第二个数的个位和第一个数的积,第二部分乘积是第二个数的十位和第一个数的乘积. 写一个程序找出所有的牛式. [格式] INPUT FORMAT: (f

USACO Chapter 1 Section 1.1

USACO的题解和翻译已经很多了... 我只是把自己刷的代码保存一下. 1.PROB Your Ride Is Here 1 /* 2 ID:xiekeyi1 3 PROG:ride 4 LANG:C++ 5 */ 6 7 #include<bits/stdc++.h> 8 using namespace std ; 9 10 int main() 11 { 12 freopen("ride.in","r",stdin); 13 freopen(&quo

USACO 4.4 Pollutant Control (网络流求最小割割集)

Pollutant ControlHal Burch It's your first day in Quality Control at Merry Milk Makers, and already there's been a catastrophe: a shipment of bad milk has been sent out. Unfortunately, you didn't discover this until the milk was already into your del

USACO Your Ride Is Here

[USACO]Your Ride Is Here It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do,

usaco月赛,2017.1总结

T1:跳舞的奶牛 大致题意:一个体积为k的舞台能够同时容纳k只奶牛一起跳舞,他们每头奶牛的跳舞时间不同,如果有一只奶牛跳完了第k+1头奶牛就会立刻上场跳舞,当所有奶牛跳完舞以后我们认为这次表演结束.现在给出奶牛个数,最多用时,每头奶牛的跳舞时间.求舞台最小为多大. 思路:本来写了个程序以为这道题很简单,刚开始排一下序然后就行了,结果交了以后发现只过了五组,然后才发现这道题不能改变顺序(所以说为什么我改变顺序了还是能过五组,usaco的数据也好水......),所以说我想到了堆,然后就用堆写了一下

插入排序的优化【不靠谱地讲可以优化到O(nlogn)】 USACO 丑数

首先我们先介绍一下普通的插排,就是我们现在一般写的那种,效率是O(n^2)的. 普通的插排基于的思想就是找位置,然后插入进去,其他在它后面的元素全部后移,下面是普通插排的代码: 1 #include<iostream> 2 #include<fstream> 3 #include<stdio.h> 4 using namespace std; 5 int a[200000]; 6 int p[200000]; 7 8 int main(){ 9 ios::sync_wi

JPA:detached entity passed to persist

Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: com.example.entity.UserInfo at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:124) at org.hibernate.event.inte

【日常学习】【最短路Dijkstra】codevs1069 usaco回家 题解

来源 usaco codevs1069 题目描述 Description 现在是晚餐时间,而母牛们在外面分散的牧场中. 农民约翰按响了电铃,所以她们开始向谷仓走去. 你的工作是要指出哪只母牛会最先到达谷仓(在给出的测试数据中,总会有且只有一只最快的母牛). 在挤奶的时候(晚餐前),每只母牛都在她自己的牧场上,一些牧场上可能没有母牛. 每个牧场由一条条道路和一个或多个牧场连接(可能包括自己). 有时,两个牧场(可能是字母相同的)之间会有超过一条道路相连. 至少有一个牧场和谷仓之间有道路连接. 因此