Skip to content

Updated Repo #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
970a900
Merge pull request #3 from spector5/master
tBostic Oct 21, 2015
17598f2
Added my attempts for a few problems
5donuts Oct 22, 2015
dbfce97
Merge pull request #4 from 5donuts/master
tBostic Oct 22, 2015
3237e00
added links to problems with other notes
5donuts Oct 23, 2015
69782e3
Updated comments with links to javadoc comments with @url tags
5donuts Oct 23, 2015
a9ce3eb
added a problem
5donuts Oct 23, 2015
f9df485
Merge remote-tracking branch 'upstream/master'
5donuts Oct 23, 2015
498a874
Merge pull request #5 from 5donuts/master
tBostic Oct 23, 2015
910c9c0
Turbo Sort Fixed
tBostic Oct 23, 2015
998535f
First Github Commit
mbw001 Oct 24, 2015
5dcc2eb
Merge pull request #6 from mbw001/master
tBostic Oct 24, 2015
795c304
A problem from last years competition
tBostic Oct 25, 2015
e8e3465
last push before repository delete
5donuts Oct 26, 2015
ee68140
Merge ../myCodeChefPractice
5donuts Oct 26, 2015
1a293f5
Fixed HOLES problem, removed unused import in TSORT
5donuts Oct 26, 2015
a9f6042
Added solution for DoubleStrings, revised comments for TurboSort
5donuts Oct 26, 2015
258257e
added skeleton for YetAnotherNumberGame problem
5donuts Oct 26, 2015
285d1fb
Updated comments in YetAnotherNumberGame
5donuts Oct 26, 2015
b84c489
added stuff for cooling pies problem
5donuts Oct 29, 2015
1ef80c7
added problem A from acm 2015 regionals
5donuts Nov 8, 2015
cee01f9
Added problem G from acm 2015 regionals
5donuts Nov 8, 2015
bea97e4
Added quick work for Lunacy problem, learned that math + tired == wro…
5donuts Nov 8, 2015
a8b9c5f
I believe a completed version of isa. Test it out and see if you can
tBostic Nov 8, 2015
7e0f5bc
I believe this is the finished program for question E that was in the
tBostic Nov 9, 2015
852a2a4
Forgot to add "kin" to the last one
tBostic Nov 9, 2015
382e345
skeleton for Cooling Pies problem
5donuts Nov 10, 2015
4f0e488
Merge branch 'master' of github.com:tBostic/CodeChefPractice
5donuts Nov 10, 2015
237066c
added problem solutions for the 2015 ACM regional competition
5donuts Nov 12, 2015
b173c53
added stuff to PositiveConSequences.java
5donuts Nov 17, 2015
8e70759
finished my version of the PositiveConSequences problem
5donuts Nov 23, 2015
4d6243a
minor changes to code chef problems
5donuts Dec 16, 2015
c72e360
got yet another number game correct
5donuts Dec 16, 2015
4745ccc
added 'a very easy problem'
5donuts Dec 16, 2015
7d02e5e
added more to 'cooling pies', removed 'a very easy problem' because o…
5donuts Dec 16, 2015
6e68968
added work on 'cooling pies', it still needs work
5donuts Dec 16, 2015
8fee052
added problem and solution
5donuts Dec 16, 2015
0c1322f
added beginning of 'count of maximum'
5donuts Dec 16, 2015
e499f0d
finished 'count of maximum', this solution can DEFINITELY be optimize…
5donuts Dec 16, 2015
acd726d
minor edits to some problems (removing unused variables, closing reso…
5donuts Dec 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path=""/>
</classpath>
17 changes: 17 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Arrrgument</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Binary file added MidAtlantic2015Problems/Arrrgument/Arrrgument.pdf
Binary file not shown.
76 changes: 76 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/Arrrgument.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
\problem{Avoiding an Arrrgument}

%\begin{wrapfigure}{r}{0.67\linewidth}
%\includegraphics[width=\linewidth]{Around/Row_Your_Boat.png}
%\end{wrapfigure}

The pirate captain and his crew gazed happily upon the chest brimming
with gemstones. Diamonds, rubies, sapphires, opals, and many other
kinds of gems added to the sparkling collection.

``We're rich, my lads!'' the captain said, ``Now, here's what we're
going to do. Each of us will take two stones now, then we'll bury the
rest because \ldots because that's what pirates do! Also, everyone
must take two different kinds of gems. We don't know what the merchants
in the next port will be buying, and I don't want to listen to any
belly-aching from someone who only took rubies if our next port
happens to have a flourishing ruby mine nearby''

``Who chooses first?'' asked the cabin boy, fearing that he already
knew the answer.

``I'll choose one first,'' said the captain, ``and then each man from
there in order of rank, starting with the first mate down to the cabin
boy''. The lower-ranked crew members began to grumble. ``Then,''
continued the captain, ``the cabin boy immediately chooses his second
gem, and we proceed in reversed order until we get to me, and I will
be the last to choose my second stone.''

The crew quickly agreed and, almost as quickly, began trying to figure
how to claim the best stones under this arrangement.

Write a program to figure out what stone a crewman should pick first
in order to maximize the total value they can be guaranteed to acquire
no matter how the rest of the crew chooses.


\subsection*{Input}

The input will consist of one or more data sets.

Each data set starts with a line containing 2 integers: $M$, the
number of kinds of gemstone available, and $N$, the number of crewmen
who select their first stone after you and select their second before
you. Each data set will have $2 \leq M \leq 26$, $0 \leq N \leq 10$.
A value of 0 for $M$ indicates the end of input.

The remainder of the dataset consists of $M$ lines, each describing one
kind of available gem. The line begins with an uppercase alphabetic
character indicating the type of gem (e.g., 'D' might denote diamonds,
'Z' might stand for zircons). No two kinds of gem will have the same
code, but the codes may occur in any order. The alphabetic code is
followed by $N+1$ integers, each demoting the value in doubloons of one
of the $N+1$ most valuable remaining gems of that kind. These will be
presented on the line in non-increasing order of value. Values will
be in the range $0\ldots 10,000$.

\subsection*{Output}

For each dataset, print a single line containing the letter code for
the type of gem that you should pick first to maximize the total value
that you can be guaranteed to receive on both picks, no matter what
choices the rest of the crew makes. If there is more than one type of
gem tied for the maximum total value, print the one the comes earliest
alphabetically.


\subsection*{Example}

Given the input:

\verbfile{Arrrgument/test0.in}


the output should be

\verbfile{Arrrgument/test0.expected}
6 changes: 6 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/Arrrgument.viva
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{[= x y (x = y = 0)]
m (2 <= m <= 26) n (0 <= n <= 10);
{[*m]
K:string (K %% "[A-Z]") <[*(n+1)] d (d# =1 || d[d# - 1] <= d[d# - 2]) >;
}
}
125 changes: 125 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/cpp/.cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1008244000">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1008244000" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1008244000" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1008244000." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1477424141" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.2071736673" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/Arrrgument-cpp}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.1975178251" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.485136339" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.170331110" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.132042519" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.11258813" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.661094961" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1969535791" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1502734387" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.1394498029" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.77208686" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1228436368" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.873466292" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2065274612" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.483221532" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.771386232" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.2051858513">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.2051858513" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.2051858513" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.2051858513." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1799276814" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.372053159" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/Arrrgument-cpp}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.1970208393" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.583479679" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.141547004" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.2091162478" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.515514160" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.667739556" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.951611837" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.879184713" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.692167414" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.913225288" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.525920682" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1393888885" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.896522471" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1873808842" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.846558531" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="Arrrgument-cpp.cdt.managedbuild.target.gnu.exe.1630963129" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.2051858513;cdt.managedbuild.config.gnu.exe.release.2051858513.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.141547004;cdt.managedbuild.tool.gnu.cpp.compiler.input.667739556">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1008244000;cdt.managedbuild.config.gnu.exe.debug.1008244000.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1969535791;cdt.managedbuild.tool.gnu.c.compiler.input.77208686">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1008244000;cdt.managedbuild.config.gnu.exe.debug.1008244000.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.170331110;cdt.managedbuild.tool.gnu.cpp.compiler.input.661094961">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.2051858513;cdt.managedbuild.config.gnu.exe.release.2051858513.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.951611837;cdt.managedbuild.tool.gnu.c.compiler.input.913225288">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.709118043;cdt.managedbuild.config.gnu.exe.debug.709118043.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.769694767;cdt.managedbuild.tool.gnu.cpp.compiler.input.827655875">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.369012225;cdt.managedbuild.config.gnu.exe.release.369012225.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1238599408;cdt.managedbuild.tool.gnu.cpp.compiler.input.1118329423">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.709118043;cdt.managedbuild.config.gnu.exe.debug.709118043.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1613186886;cdt.managedbuild.tool.gnu.c.compiler.input.789020891">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.369012225;cdt.managedbuild.config.gnu.exe.release.369012225.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.2078330913;cdt.managedbuild.tool.gnu.c.compiler.input.1936692765">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>
27 changes: 27 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/cpp/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Arrrgument-cpp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
72 changes: 72 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/cpp/Arrrgument_bcs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Sample solution for Avoiding an Arrrgument
// Author: Bryce Sandlund

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, char> ic;
typedef vector<ic> vic;

ll M, N;

// just simulate worst-case scenario with given choice of first gem
ll simulate(vic &gems, char choice) {
ll pirate_ct = 0;
ll me = 0;
for (ll i = 0; i < gems.size(); ++i) {
if (gems[i].second == choice) {
me = gems[i].first;
break;
}
}

for (ll i = 0; i < gems.size(); ++i) {
if (gems[i].second != choice) {
if (pirate_ct == N) {
me += gems[i].first;
break;
}
++pirate_ct;
}
}
return me;
}

int main() {
for (ll cs = 1; cin >> M >> N && M; ++cs) {
vic gems;
set<char> choices;
for (ll i = 0; i < M; ++i) {
char G;
cin >> G;
choices.insert(G);

for (ll j = 0; j < N+1; ++j) {
ll val;
cin >> val;
gems.push_back(ic(val, G));
}
}

sort(gems.rbegin(), gems.rend());

ll ans = -1;
char gem;
for (set<char>::iterator it = choices.begin(); it != choices.end(); ++it) {
ll cur_ans = simulate(gems, *it);
if (cur_ans > ans || (cur_ans == ans && *it < gem)) {
ans = cur_ans;
gem = *it;
}
}

cout << gem << endl;
}
return 0;
}
6 changes: 6 additions & 0 deletions MidAtlantic2015Problems/Arrrgument/java/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path=""/>
</classpath>
Loading