Skip to content

Commit 6dde553

Browse files
committed
Add samples
1 parent ba03631 commit 6dde553

File tree

879 files changed

+170624
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

879 files changed

+170624
-0
lines changed

samples/Batch/cup/.gitignore

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/sandbox/
2+
/tests/
3+
/logs/
4+
5+
# C++.gitignore
6+
7+
# Compiled Object files
8+
*.slo
9+
*.lo
10+
*.o
11+
*.obj
12+
13+
# Precompiled Headers
14+
*.gch
15+
*.pch
16+
17+
# Compiled Dynamic libraries
18+
*.so
19+
*.dylib
20+
*.dll
21+
22+
# Compiled Static libraries
23+
*.lai
24+
*.la
25+
*.a
26+
*.lib
27+
28+
# Executables
29+
*.exe
30+
*.app
31+
*.out
32+
# Except public directory
33+
!/public/**/*.out
34+
35+
# Java.gitignore
36+
37+
# Compiled class file
38+
*.class
39+
40+
# Log file
41+
*.log
42+
43+
# Package Files #
44+
*.jar
45+
*.war
46+
*.ear
47+
*.zip
48+
*.tar.gz
49+
*.rar
50+
51+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
52+
hs_err_pid*
53+
54+
# Vim.gitignore
55+
56+
# Swap
57+
[._]*.s[a-v][a-z]
58+
[._]*.sw[a-p]
59+
[._]s[a-v][a-z]
60+
[._]sw[a-p]
61+
62+
# Session
63+
Session.vim
64+
65+
# Temporary
66+
.netrwhist
67+
*~
68+
69+
# macOS.gitignore
70+
71+
# General
72+
*.DS_Store
73+
.AppleDouble
74+
.LSOverride
75+
76+
# Icon must end with two \r
77+
Icon
78+
79+
80+
# Thumbnails
81+
._*
82+
83+
# Files that might appear in the root of a volume
84+
.DocumentRevisions-V100
85+
.fseventsd
86+
.Spotlight-V100
87+
.TemporaryItems
88+
.Trashes
89+
.VolumeIcon.icns
90+
.com.apple.timemachine.donotpresent
91+
92+
# Directories potentially created on remote AFP share
93+
.AppleDB
94+
.AppleDesktop
95+
Network Trash Folder
96+
Temporary Items
97+
.apdisk
98+
99+
# Linux.gitignore
100+
101+
*~
102+
103+
# temporary files which can be created if a process still has a handle open of a deleted file
104+
.fuse_hidden*
105+
106+
# KDE directory preferences
107+
.directory
108+
109+
# Linux trash folder which might appear on any partition or disk
110+
.Trash-*
111+
112+
# .nfs files are created when an open file is removed but is still being accessed
113+
.nfs*
114+
115+
# JetBrains.gitignore
116+
117+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
118+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
119+
120+
.idea/
121+
122+
# Eclipse
123+
/.project
124+
125+
# CMake
126+
cmake-build-debug/
127+
128+
## File-based project format:
129+
*.iws
130+
131+
# Pascal.gitignore
132+
*.ppu
133+
134+
# Python.gitignore
135+
136+
# Byte-compiled / optimized / DLL files
137+
__pycache__/
138+
*.py[cod]
139+
*$py.class

samples/Batch/cup/.scripts_version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.6

samples/Batch/cup/LICENSE

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
IOI 2017, Iran
2+
Practice Tasks
3+
Task: cup

samples/Batch/cup/checker/Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
SOURCES := $(wildcard *.cpp)
2+
EXECUTABLES := $(SOURCES:%.cpp=%.exe)
3+
4+
.PHONY: all clean
5+
6+
all: $(EXECUTABLES)
7+
8+
clean:
9+
rm -f *.exe
10+
11+
%.exe: %.cpp testlib.h
12+
g++ -std=gnu++1y -Wall -Wextra -O2 $< -o $@

samples/Batch/cup/checker/checker.cpp

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include "testlib.h"
2+
#include <iostream>
3+
#include <fstream>
4+
#include <iomanip>
5+
#include <cstdlib>
6+
using namespace std;
7+
8+
const string output_secret = "be6fe19e-6ee7-4837-a81e-6f6902743b31";
9+
10+
NORETURN void qp(int grade) {
11+
quitp(grade/double(100));
12+
}
13+
14+
int main(int argc, char *argv[]){
15+
registerChecker("cup", argc, argv);
16+
17+
ouf.readSecret(output_secret);
18+
ouf.readGraderResult();
19+
20+
21+
inf.readLine();//input_secret
22+
int tests = inf.readInt();
23+
24+
25+
int Q = 0;
26+
for (int test=0; test<tests; test++) {
27+
int t = ouf.readInt();
28+
if (t < 0) {
29+
Q = -1;
30+
break;
31+
}
32+
if (Q < t) {
33+
Q = t;
34+
}
35+
}
36+
if (Q < 0)
37+
quitf(_wa, "wrong cup location");
38+
if (1000 < Q) qp(0);
39+
if (104 < Q) qp(20);
40+
if (70 < Q) qp(30);
41+
if (39 < Q) qp(61);
42+
if (32 < Q) qp(132-Q);
43+
// Q <= 32
44+
quit(_ok);
45+
return 0;
46+
}
47+

0 commit comments

Comments
 (0)