Author SHA1 Message Date
Zacharias 67a2198180 Added readme 2026-09-18 10:53:16 +02:00
Zacharias e260c51b70 Initial Commit 2026-09-18 10:52:59 +02:00
17 changed files with 20 additions and 265 deletions

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="KubernetesApiProvider"><![CDATA[{}]]></component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
Generated
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+3
View File
@@ -0,0 +1,3 @@
# NCPC26 final practive
This branch contaisn the code from the final practice(18th september 2026) for NCPC26!
+2
View File
@@ -3,6 +3,8 @@
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
File renamed without changes.
+10
View File
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
@@ -2,7 +2,7 @@ plugins {
id 'java'
}
group = 'org.example'
group = 'com.kattis.ncpc26.pf'
version = '1.0-SNAPSHOT'
repositories {
@@ -10,7 +10,7 @@ repositories {
}
dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation platform('org.junit:junit-bom:6.0.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
@@ -1,6 +1,6 @@
#Sat Oct 04 11:03:43 CEST 2025
#Fri Sep 18 10:45:37 CEST 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
View File
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
rootProject.name = 'NCPC26-practive-final'
-1
View File
@@ -1 +0,0 @@
rootProject.name = 'NCPC-g'
@@ -1,23 +0,0 @@
package com.kattis.ncpc26.p3.pending;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class A {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(reader.readLine());
String s = reader.readLine();
String[] nums = s.split(" ");
for(int i = 1; i <= num; i++){
if(!(nums[i-1].equals("mumble") || Integer.parseInt(nums[i-1]) == i))
{
System.out.println("something is fishy");
return;
}
}
System.out.println("makes sense");
}
}
@@ -1,112 +0,0 @@
package com.kattis.ncpc26.p3.pending;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class B {
public static void main(String[] args) throws IOException {
Map<Integer, Set<Integer>> exclusiveFollowing = new HashMap<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String in = reader.readLine();
int N = Integer.parseInt(in.split(" ")[0]);
int M = Integer.parseInt(in.split(" ")[1]);
for(int i = 0; i < M; i++)
{
in = reader.readLine();
int u = Integer.parseInt(in.split(" ")[0]);
int v = Integer.parseInt(in.split(" ")[1]);
Set<Integer> followings = exclusiveFollowing.getOrDefault(v, new HashSet<>());
followings.add(u);
exclusiveFollowing.put(v, followings);
}
ArrayList<Pair<Integer, Integer>> sortedFollowings = new ArrayList<>();
for(Map.Entry<Integer, Set<Integer>> user : exclusiveFollowing.entrySet())
{
int me = user.getKey();
int likesMe = 0;
for(int i : user.getValue())
{
if(!exclusiveFollowing.getOrDefault(i, new HashSet<>()).contains(me))
{
likesMe++;
}
}
sortedFollowings.add(new Pair<>(me, likesMe));
}
int mostFollowedUser = 1, followers = 0;
for(Pair<Integer, Integer> user : sortedFollowings)
{
if(user.value > followers)
{
mostFollowedUser = user.key;
followers = user.value;
}
else if(user.value == followers)
{
if(user.key < mostFollowedUser)
{
mostFollowedUser = user.key;
}
}
}
System.out.printf("%d %d", mostFollowedUser, followers);
}
public static class Pair<K, V> {
/**
* The key of the pair.
*/
private K key;
/**
* The value of the pair.
*/
private V value;
/**
* Creates a new instance of Pair.
* @param key The key of the pair
* @param value The value of the pair
*/
public Pair(K key, V value) {
this.key = key;
this.value = value;
}
/**
* Gets the key of the pair.
* @return The key of the pair
*/
public K getKey() {
return key;
}
/**
* Gets the value of the pair.
* @return The value of the pair
*/
public V getValue() {
return value;
}
/**
* Sets the key of the pair.
* @param key The key of the pair
*/
public void setKey(K key) {
this.key = key;
}
/**
* Sets the value of the pair.
* @param value The value of the pair
*/
public void setValue(V value) {
this.value = value;
}
}
}
@@ -1,91 +0,0 @@
package com.kattis.ncpc26.p3.pending;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class D {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String in;
int num = 0;
while(!(in = reader.readLine()).equals("0 0"))
{
Map<Integer, Set<Integer>> knownNumbers = new HashMap<>();
int p = Integer.parseInt(in.split(" ")[0]);
int c = Integer.parseInt(in.split(" ")[1]);
if(p == 1)
{
System.out.println("No");
continue;
}
for(int i = 0; i < c; i++)
{
in = reader.readLine();
int a = Integer.parseInt(in.split(" ")[0]);
int b = Integer.parseInt(in.split(" ")[1]);
if(!(a < p || b < p || a == b))
{
continue;
}
Set<Integer> numbersKnown = knownNumbers.getOrDefault(a, new HashSet<>());
numbersKnown.add(b);
knownNumbers.put(a, numbersKnown);
numbersKnown = knownNumbers.getOrDefault(b, new HashSet<>());
numbersKnown.add(a);
knownNumbers.put(b, numbersKnown);
}
Set<Integer> reached = new HashSet<>();
ArrayList<Integer> toTraverse = new ArrayList<>();
toTraverse.add(0);
while(!toTraverse.isEmpty())
{
int node = toTraverse.getFirst();
toTraverse.removeFirst();
if(reached.contains(node)) continue;
knownNumbers.getOrDefault(node, new HashSet<>()).forEach(
(num1) -> {
if(!toTraverse.contains(num1) && !reached.contains(num1))
{
toTraverse.add(num1);
}
}
);
reached.add(node);
}
if(reached.size() < p)
{
System.out.println("Yes");
continue;
}
boolean prematureExit = false;
for(Map.Entry<Integer, Set<Integer>> e : knownNumbers.entrySet())
{
if(e.getValue().size() <= 1)
{
System.out.println("Yes");
prematureExit = true;
break;
}
}
if(!prematureExit)
{
System.out.println("No");
}
}
}
}