Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7296272e55
|
||
|
|
7a00567502
|
||
|
|
39396cedd3 |
No files matched your search
File renamed without changes.
Generated
-2
@@ -3,8 +3,6 @@
|
|||||||
/workspace.xml
|
/workspace.xml
|
||||||
# Editor-based HTTP Client requests
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
# Ignored default folder with query files
|
|
||||||
/queries/
|
|
||||||
# Datasource local storage ignored files
|
# Datasource local storage ignored files
|
||||||
/dataSources/
|
/dataSources/
|
||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
Generated
+17
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
Generated
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?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
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# NCPC26 final practive
|
|
||||||
|
|
||||||
This branch contaisn the code from the final practice(18th september 2026) for NCPC26!
|
|
||||||
@@ -2,7 +2,7 @@ plugins {
|
|||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.kattis.ncpc26.pf'
|
group = 'org.example'
|
||||||
version = '1.0-SNAPSHOT'
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -10,7 +10,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation platform('org.junit:junit-bom:6.0.0')
|
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
}
|
}
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int array[26];
|
|
||||||
int time = 0;
|
|
||||||
char problem;
|
|
||||||
char RightOrWrong[10];
|
|
||||||
int sum = 0;
|
|
||||||
int solved = 0;
|
|
||||||
int is_solved[26];
|
|
||||||
|
|
||||||
for (int i = 0 ; i < 26; i++){
|
|
||||||
is_solved[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 26; i++)
|
|
||||||
{
|
|
||||||
array[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(scanf("%d %c %s", &time, &problem, &RightOrWrong) == 3 && time != -1){
|
|
||||||
|
|
||||||
|
|
||||||
switch (problem){
|
|
||||||
case 'A':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[0] += 20;
|
|
||||||
}else{
|
|
||||||
array[0] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[0] = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'B':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[1] += 20;
|
|
||||||
}else{
|
|
||||||
array[1] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[1] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'C':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[2] += 20;
|
|
||||||
}else{
|
|
||||||
array[2] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[2] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'D':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[3] += 20;
|
|
||||||
}else{
|
|
||||||
array[3] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[3] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'E':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[4] += 20;
|
|
||||||
}else{
|
|
||||||
array[4] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[4] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'F':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[5] += 20;
|
|
||||||
}else{
|
|
||||||
array[5] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[5] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'G':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[6] += 20;
|
|
||||||
}else{
|
|
||||||
array[6] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[6] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'H':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[7] += 20;
|
|
||||||
}else{
|
|
||||||
array[7] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[7] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'I':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[8] += 20;
|
|
||||||
}else{
|
|
||||||
array[8] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[8] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'J':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[9] += 20;
|
|
||||||
}else{
|
|
||||||
array[9] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[9] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'K':
|
|
||||||
if (strcmp(RightOrWrong, "wrong")==0){
|
|
||||||
array[10] += 20;
|
|
||||||
}else{
|
|
||||||
array[10] += time;
|
|
||||||
solved += 1;
|
|
||||||
is_solved[10] = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int i = 0; i <= 26; i++)
|
|
||||||
{
|
|
||||||
if(is_solved[i]==1){
|
|
||||||
sum += array[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
printf("%d %d", solved, sum);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Vendored
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#Fri Sep 18 10:45:37 CEST 2026
|
#Sat Oct 04 11:03:43 CEST 2025
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
File renamed without changes.
File renamed without changes.
-10
@@ -1,10 +0,0 @@
|
|||||||
# 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
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
rootProject.name = 'NCPC26-practive-final'
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class B {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class D {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class E {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class F {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class G {
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package com.kattis.ncpc26.pf;
|
|
||||||
|
|
||||||
public class I {
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
l = 0
|
|
||||||
r = 1001
|
|
||||||
m = 500
|
|
||||||
temp = m
|
|
||||||
|
|
||||||
for i in range(10):
|
|
||||||
print(m)
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
term = input()
|
|
||||||
|
|
||||||
if term == "correct":
|
|
||||||
exit()
|
|
||||||
elif term == "lower":
|
|
||||||
temp = m
|
|
||||||
m = (l + m) // 2
|
|
||||||
r = temp
|
|
||||||
else:
|
|
||||||
temp = m
|
|
||||||
m = (m + r) // 2
|
|
||||||
l = temp
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
ball = 1
|
|
||||||
|
|
||||||
for i in range(5):
|
|
||||||
j = int(input())
|
|
||||||
k = int(input())
|
|
||||||
|
|
||||||
if j == ball:
|
|
||||||
ball = k
|
|
||||||
elif k == ball:
|
|
||||||
ball = j
|
|
||||||
|
|
||||||
print(ball)
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'NCPC-g'
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user