交了个朴素就过了!!!!!!!!!!

评测结果
编译成功

Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling foo.pas
foo.pas(37,13) Warning: Variable "a" does not seem to be initialized
Linking foo.exe
41 lines compiled, 0.1 sec , 28448 bytes code, 1628 bytes data
1 warning(s) issued
测试数据 #0: Accepted, time = 0 ms, mem = 908 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 916 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 912 KiB, score = 10
测试数据 #3: Accepted, time = 15 ms, mem = 912 KiB, score = 10
测试数据 #4: Accepted, time = 62 ms, mem = 912 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 908 KiB, score = 10
测试数据 #6: Accepted, time = 15 ms, mem = 908 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 908 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 912 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 912 KiB, score = 10
Accepted, time = 107 ms, mem = 916 KiB, score = 100
代码
Var a:Array[0..15000] of Longint;
map:Array[0..15005,1..2] of Longint;
i,j,t,n:Longint;
Procedure qsort(l,r:Longint);
Var i,j,mid1,mid2:Longint;
Begin
i:=l;
j:=r;
mid1:=map[(l+r) Div 2,1];
mid2:=map[(l+r) Div 2,2];
Repeat
While (map[i,1]>mid1) Or ((map[i,1]=mid1) And (map[i,2]>mid2)) Do Inc(i);
While (map[j,1]<mid1) Or ((map[j,1]=mid1) And (map[j,2]<mid2)) Do Dec(j);
If (i<=j) Then
Begin
map[0]:=map[i];
map[i]:=map[j];
map[j]:=map[0];
Inc(i);
Dec(j);
End;
Until i>j;
If (j>l) Then qsort(l,j);
If (i<r) Then qsort(i,r);
End;
Begin
Readln(n);
For i:=1 To n Do
Readln(map[i,1],map[i,2]);
qsort(1,n);
For i:=1 To n Do
Begin
t:=0;
For j:=i+1 To n do
If (map[i,1]>=map[j,1]) And (map[i,2]>=map[j,2]) Then
Inc(t);
Inc(a[t]);
End;
For i:=0 To n-1 Do
Writeln(a[i]);
End.

3 条评论

  • @ 2017-04-03 15:21:16

    不用排序吧?

    var
      a, b:array[1..15000] of longint;
      f:array[0..14999] of longint;
      n, i, j, s:longint;
    begin
      readln(n);
      for i:=1 to n do readln(a[i], b[i]);
      fillchar(f, sizeof(f), 0);
      for i:=1 to n do begin
        s:=0;
        for j:=1 to n do if (i<>j) and (a[i]>=a[j]) and (b[i]>=b[j]) then inc(s);
        inc(f[s])
      end;
      for i:=0 to n-1 do writeln(f[i])
    end.
    
    
  • @ 2015-05-04 13:07:15

    #include <cstdio>
    #include <cmath>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    using namespace std;
    int x[5005],y[5005];
    int n,k;
    int a[5005];
    int main (){
    freopen ("trench.in","r",stdin);
    freopen ("trench.out","w",stdout);
    scanf ("%d",&n);

    for(int i=0;i<n;i++)
    scanf ("%d%d",&x[i],&y[i]);
    for (int i=0;i<n;i++){
    k=0;
    for (int j=0;j<n;j++)
    if (i!=j && x[i]>=x[j] && y[i]>=y[j])
    k++;

    a[k]++;

    }
    for (int i=0;i<n;i++)
    printf ("%d\n",a[i]);
    return 0;
    }

  • @ 2014-04-11 20:14:35

    Good!

  • 1

信息

ID
1066
难度
4
分类
数据结构 | 树状数组数据结构 | 线段树 点击显示
标签
(无)
递交数
4667
已通过
2022
通过率
43%
被复制
9
上传者