ACM??????????? ACM International Collegiate Programming Contest (ACM-ICPC) - PowerPoint PPT Presentation

About This Presentation
Title:

ACM??????????? ACM International Collegiate Programming Contest (ACM-ICPC)

Description:

ACM ACM International Collegiate Programming Contest ACM-ICPC – PowerPoint PPT presentation

Number of Views:205
Avg rating:3.0/5.0
Slides: 44
Provided by: jiang162
Category:

less

Transcript and Presenter's Notes

Title: ACM??????????? ACM International Collegiate Programming Contest (ACM-ICPC)


1
ACM???????????ACM International Collegiate
Programming Contest(ACM-ICPC)
2
ACM-ICPC
  • ???????????????
  • ????Baylor University,?????(Association for
    Computing Machinery, ACM) ?IBM????

3
ICPC??Battle of the Brains
  • ???????????????
  • ????????,????????,?????????????,??????????????????
    ,??????????
  • ??????????????????,?????????????

4
??
  • ???1970????????AM???????????????the Alpha
    Chapter of the UPE Computer Science Honor
    Society?
  • ??,??????????????,?1977??ACM????????
  • ?1997?IBM????????,?????????

5
Contest Rule
  • ICPC ??????
  • ??? (Regional Contest)
  • ??? (World Final)
  • ?????????????????,??????????
  • ?????????????????,??????????????

6
Contest Rule
  • ?????????????,???3??????
  • ?????????????(????????),??????2???????4???????
  • ????1????5??????C?C?Java?Pascal??????8?10???,???
    ?????????????????

7
Contest Rule
  • ?????????????????????????
  • ??????????????????20??penalty?

8
Contest Rule
  • ???????????????????,??????????????,????? accepted
    (??) ? wrong answer (??),???????????????????
  • ????
  • Accepted
  • Accepted (P.E.)
  • Wrong Answer
  • Time Limit Exceeded
  • etc

9
Error Messages
  • Accepted ???????????????,????????????.
  • Aceepted (P.E.) (Presentation Error)????Accepted,
    ??????????,????????? (???????,???????).
  • Wrong Answer???????????,????????????.
  • Time Limit Exceeded (TL)??? Judge
    ????????,?????????????????.
  • Memory Limit Exceeded (ML) ?????????????.
  • Output Limit Exceeded (OL)???????,????.

10
Error Messages
  • Compile Error (CE)????
  • Submission Error (SE)??,???ID,???????,??????????
  • Runtime Error(SIGSEGV)??????,????????,??????????,
    ??????0,???????????(?????????????)
  • Restricted Function (RF)???????????????(?????),?s
    ystem (...)

11
Contest Rule
  • ??A?B???????????
  • A???????100?245????
  • A??????100245345
  • B???????120?200????,?B???????2?(????)?
  • B?????120200020340
  • B??????????

12
??????
  • ????????????????????,??????????
  • ????? ACM ??????????????????,?????? ACM
    ????????????????,??????????
  • ??????????????? ACM ??????????????????????,???????
    ??????????????

13
??????
  • ?34 ?ACM ?????????????? ???
  • 2009 the 34th Annual ACM International Collegiate
    Programming ContestAsia Regional Hsinchu Site
  • ????????
  • ??????
  • 2009 ?10 ?3011?1 ?

14
2010 Final
  • The 34th ACM International Collegiate
    Programming Contest World Finals
  • Harbin, China, February 1-6, 2010

15
Tips
  • ???Online Judge?????
  • Universidad de Valladolid Online Judge
  • Ural State University Online Judge
  • Tianjin University Online Judge
  • Saratov State University Online Judge
  • Sphere Online Judge
  • ACM-ICPC Live Archive Around the World
  • MIPT Online Judge
  • Peking University Online Judge
  • Zhejiang University Online Judge
  • Harbin Institute of Technology Online Judge
  • Fuzhou University Online Judge
  • Online Problems Solving System

16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
(No Transcript)
26
(No Transcript)
27
(No Transcript)
28
Tips
  • ????????
  • ????????????? GNU/Linux SUSE Enterprise for
    desktop 10
  • World Final????????Fedora Core 4 Linux
  • ???????????????
  • ??????????? GNU C/C ?????? Eclipse
  • World Final?????? Java (version 1.5)?C/C (GCC
    4.0)? Pascal ?????? Java - Eclipse 3.1?C/C -
    CDT 3.0 under Eclipse 3.1?Pascal - Borland Kylix
    Version 3.0
  • ??????????
  • PC2 (Programming Contest Control System)

29
Tips
  • ??????
  • ????????????
  • ??????
  • ??????
  • ?????????,????????,???????
  • ??????????????,???????????????
  • ????
  • ?????????????????????????????????????,????????????
    ????????????PDA,?????????????,???????????
  • ??????????

30
Tips
  • ???(??)?????????C Standard Template Library
  • E.G.include ltstl.hgtstackltintgt Squeueltchargt
    Qpriority_queueltintgt PQ
  • stack - S.push(), S.top(), S.pop(), S.empty()
  • You should always top on pop because top returns
    but does not remove the element on top, while pop
    removes but does not return the element.
  • Linked implementations ensure the stack will
    never be full.
  • queue Q.front(), Q.back(), Q.push(), Q.pop(),
    and Q.empty()
  • hash_map H.erase(), H.find(), H.insert()
  • priority_queue PQ.push(), PQ.top(), PQ.pop(),
    PQ.empty()
  • set S.set_union, S.set_intersection
  • sort or stable_sort

31
ACM 10041
  • Vitos family

32
??
  • Background 
  • The world-known gangster Vito Deadstone is moving
    to New York. He has a very big family there, all
    of them living in Lamafia Avenue. Since he will
    visit all his relatives very often, he is trying
    to find a house close to them.
  • Problem 
  • Vito wants to minimize the total distance to all
    of them and has blackmailed you to write a
    program that solves his problem.

33
Input output
  • Input 
  • The input consists of several test cases. The
    first line contains the number of test cases. For
    each test case you will be given the integer
    number of relatives r ( 0 lt r lt 500) and the
    street numbers (also integers) where they live
    ( 0 lt si lt 30000 ). Note that several relatives
    could live in the same street number.
  • Output 
  • For each test case your program must write the
    minimal sum of distances from the optimal Vito's
    house to each one of his relatives. The distance
    between two street numbers si and sj is dij
    si-sj.

34
????
  • ????? Ai i 0.n
  • ?? k, ?? ????
  • ??????

35
Sample input output
  • Sample Input 
  • 2 2 2 4 3 2 4 6
  • Sample Output 
  • 2 4

36
????
  • ????????(median),???????????

37
??Java???
  • import java.util.
  • class Vito
  • static int ??new int500
  • static Scanner ?? new Scanner(System.in)
  • public static void main(String ??)
  • int ??? ??.nextInt()
  • for(int i1ilt???i)
  • System.out.println(?????????())
  • //??main() ??????
  • static long ?????????()
  • long ???0
  • int ????
  • int ?? ??.nextInt()
  • for (int i0ilt??i)
  • ??i ??.nextInt()

38
??Java???
  • for (int i??-1igt1--i)
  • for (int j0jlti-1 j)
  • if(??jgt??j1)
  • int t??j
  • ??j??j1
  • ??j1t
  • ????????/2
  • for (int i0ilt??i)
  • ???Math.abs(??i-????)
  • return ???
  • //???????????() ??????
  • //??Vito ??????

39
(No Transcript)
40
Java???
  • import java.util.Scanner
  • /When you submit your program to UVa Judge, you
    have to change the class name to be Main. And use
    only variables in English. Or you will get
    compilation error /
  • class Vito2 //change the calss name to be Main.
    Or you will get runtime error
  • static int Addressnew int500
  • static Scanner input new Scanner(System.in)
  • public static void main(String args)
  • int cases input.nextInt()
  • for(int i1iltcasesi)
  • System.out.println(process())
  • //??main() ??????
  • static long process()
  • long totalD0
  • int bestAddress
  • int people input.nextInt()
  • for (int i0iltpeoplei)
  • Addressi input.nextInt()
  • for (int ipeople-1igt1--i)
  • for (int j0jlti-1 j)
  • if(AddressjgtAddressj1)

41
Java???
  • for (int ipeople-1igt1--i)
  • for (int j0jlti-1 j)
  • if(AddressjgtAddressj1)
  • int tAddressj
  • AddressjAddressj1
  • Addressj1t
  • bestAddressAddresspeople/2
  • for (int i0iltpeoplei)
  • totalDMath.abs(Addressi-bestAddress)
  • return totalD
  • //??process() ??????
  • //??Vito2 ??????

42
C???
  • include "iostream.h"
  • include "math.h"
  • int door500
  • long int process()
  • int main()
  • int cases
  • cingtgtcases
  • for(int i1iltcasesi)
  • coutltltprocess()ltltendl
  • return 0
  • //??main() ??????
  • long int process()
  • long int total0
  • int best
  • int people
  • cingtgtpeople
  • for (int i0iltpeoplei)
  • cingtgtdoori
  • for (int ipeople-1igt1--i)

43
C???
  • for (int ipeople-1igt1--i)
  • for (int j0jlti-1 j)
  • if(doorjgtdoorj1)
  • int tdoorj
  • doorjdoorj1
  • doorj1t
  • bestdoorpeople/2
  • for (int i0iltpeoplei)
  • total(long int)fabs(doori-best)
  • return total
  • //??process() ??????
Write a Comment
User Comments (0)
About PowerShow.com